【发布时间】:2015-11-19 10:56:52
【问题描述】:
我的工具栏中有一个文本视图和一个标签布局。我希望 textview 出现在顶部,tablayout 出现在底部,但无论我如何尝试对齐它们,tablayout 都不会出现在底部而是出现在我的 textview 的右侧
我应该怎么做才能正确对齐它们?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.country.kenya.MainActivity"
android:id="@+id/main_layout"
>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:id="@+id/mainActivityBar"
android:layout_alignParentTop="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Uhuru Kenyatta"
android:id="@+id/appname_view"
android:gravity="top|left" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"
android:background="@android:color/transparent"
/>
</android.support.v7.widget.Toolbar>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.country.kenya.MainActivity"
android:layout_below="@+id/mainActivityBar" />
</RelativeLayout>
【问题讨论】:
标签: android android-layout android-toolbar android-tabs