这是我创建标签的代码(底部),工作正常。
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<LinearLayout
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp"
android:orientation="vertical">
<!-- Tab 1 content -->
<include layout="@layout/tab1" />
</LinearLayout>
<LinearLayout
android:id="@+id/tab2"
android:layout_width="match_parent"
android:layout_height="450dp"
android:orientation="vertical">
<!-- Tab 2 content -->
<include layout="@layout/tab2" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>
</TabHost>
我已经以多种方式添加了提升属性(对于制表符,tabHost,到布局......),但它们都不起作用。我在这里找到了一些解决方案,但没有一个适合我。有关此特定代码的任何想法吗?
答案 0 :(得分:0)
高程属性仅适用于具有背景的视图,但您的视图是透明的。您可以尝试为TabHost设置背景和高程,或将整个标签栏放入AppBarLayout。