【发布时间】:2020-06-06 04:54:42
【问题描述】:
我为不同的屏幕尺寸做了不同的设计。正常屏幕尺寸的图像看起来像我想要的那样。我遇到了这个错误,找不到解决方案。 更改 Tablayout 的大小不起作用。enter image description here
我在两个设计中使用相同的代码
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:theme="@style/AppBarOverlay">
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@drawable/banner"
app:layout_anchor="@+id/appBarLayout"
app:layout_anchorGravity="center"
app:tabIndicatorColor="#00b7fa">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/buyutec50" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/plus50" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/table50" />
</com.google.android.material.tabs.TabLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
【问题讨论】:
标签: android xml tabs android-tablayout