【发布时间】:2017-08-25 12:21:04
【问题描述】:
我在 xml 中指定了 tablayout 小部件,如下所示:
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
style="@style/AppTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@color/tabBg"
android:minHeight="?attr/actionBarSize"
app:tabTextColor="@color/grey"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
我设置了一个 ViewPager 滚动浏览每个选项卡的视图。现在在其中一个视图中 - 选项卡 3,我需要在 @id/tabLayout 下方排列我的组件
这是tab3.xml的内容:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/secondtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tabLayout"
android:background="@android:color/white"
android:text="second"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/thirdtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/secondtext"
android:background="@android:color/white"
android:text="third"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
第二个和第三个文本视图都显示在 tabLayout 后面,它们被 tabLayout 覆盖/隐藏。如何指定要在 tabLayout 正下方显示的文本视图,以便文本可见?
【问题讨论】:
标签: android xml android-widget