为Android应用程序创建viber iOS工具栏

时间:2017-04-29 06:04:46

标签: android android-toolbar

我想为Android创建viber iOS like toolbar。有关详细信息,请参见下图。

viber ios toolbar

我希望工具栏中有两个按钮的“全部”和“组”,并在单击按钮时在主活动中加载相应的片段。

任何人都可以帮我创建此工具栏的布局。提前谢谢。

1 个答案:

答案 0 :(得分:0)

XML文件将是:

onCurrentIndexChanged

Drawables文件将如下:

<强> 1。 corner_drawable.xml

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorAccent"
        android:orientation="horizontal"
        android:padding="10dp">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@drawable/common_google_signin_btn_text_dark" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/corner_drawable"
                android:gravity="center"
                android:padding="10dp"
                android:text="All" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/corner_drawable_1"
                android:gravity="center"
                android:padding="10dp"
                android:text="Groups"
                android:textColor="@android:color/white" />
        </LinearLayout>

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@drawable/common_google_signin_btn_text_dark" />
    </LinearLayout>

<强> 2。 corner_drawable1.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners
        android:bottomLeftRadius="10dp"
        android:topLeftRadius="10dp" />
    <solid android:color="@android:color/white" />
</shape>
相关问题