我按照这个教程做了。我只是简单地修改了一下,将TabLayout显示在屏幕底部。
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager_landing"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"
android:background="@android:color/white" />
<android.support.design.widget.TabLayout
android:id="@+id/sliding_tabs_landing"
style="@style/MyCustomTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed" />
</LinearLayout>
问题:
TabIndicator
显示在屏幕底部,工作正常。现在我想将 TabIndicator
显示在标签的顶部,而不是底部。使用自定义布局可以实现这一点,如教程中所述,但是否有任何 XML 属性可以将 TabIndicator
显示在顶部?