造型底部操作图标现在的位置和背景颜色 [英] styling bottom action icon postion and background color

查看:148
本文介绍了造型底部操作图标现在的位置和背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个底部操作栏样式

I have this bottom action bar style

输入图像的描述在这里

我想设计这样的(左,中,右)与背景颜色为蓝色或红色

I want to design like this (left , center, right) with background color blue or red

输入图像的描述在这里

这是菜单

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
    <item android:id="@+id/action_settings" android:title="@string/action_settings"
        android:orderInCategory="100" app:showAsAction="never" />

    <item android:id="@+id/menu_save"
        android:icon="@drawable/ic_action_picture"
        android:title="Save"
        app:showAsAction="always"/>

    <item android:id="@+id/menu_search"
        android:icon="@drawable/ic_action_picture"

        android:title="Search"
        app:showAsAction="always"/>

    <item android:id="@+id/menu_share"
        android:icon="@drawable/ic_action_picture"
        android:title="Share"
        app:showAsAction="always"
        />

</menu>

如果您有什么需要问我

推荐答案

如果您还没有解决您的问题,你可以参考以下内容:

If you have not solved your issue, you can refer to the following:

activity_main.xml:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_main" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar_bottom"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:layout_alignParentBottom="true"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay">

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">

                <ImageButton
                    android:id="@+id/button1"
                    android:layout_width="10dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.175"
                    android:background="@android:color/transparent"
                    android:src="@drawable/ic_action_back" />

                <View
                    android:id="@+id/view1"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_weight="0.1" />

                <ImageButton
                    android:id="@+id/button2"
                    android:layout_width="10dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.175"
                    android:background="@android:color/transparent"
                    android:src="@drawable/ic_action_cloud" />

                <View
                    android:id="@+id/view2"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_weight="0.1"
                    android:background="@android:color/transparent" />

                <ImageButton
                    android:id="@+id/button3"
                    android:layout_width="10dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.175"
                    android:background="@android:color/transparent"
                    android:src="@drawable/ic_action_copy" />

                <View
                    android:id="@+id/view3"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_weight="0.1"
                    android:background="@android:color/transparent" />

                <ImageButton
                    android:id="@+id/button4"
                    android:layout_width="10dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.175"
                    android:background="@android:color/transparent"
                    android:src="@drawable/ic_action_help" />

            </LinearLayout>

        </android.support.v7.widget.Toolbar>

    </RelativeLayout>

</android.support.design.widget.CoordinatorLayout>

BNK的屏幕截图

这篇关于造型底部操作图标现在的位置和背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆