android - ViewPagerAdapter 工具栏可水平滚动
问题描述
我有一个带有许多选项卡的工具栏,但是当标签太多时,内部的文本被拆开,所有标签都在我的屏幕上。我希望我的工具栏可以滚动,但我自己不能这样做。
有我的布局:
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:scrollbars="horizontal"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:layout_scrollFlags="scroll|enterAlways"
/>
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
我试图用 NestedScrollView 替换 appbarlayout 但不起作用。谢谢你的帮助。
您可以看到选项卡的名称被拆分,因为选项卡太多。我希望将工具栏的大小调整为选项卡,并且无法在 tabLayout 中水平滚动。
解决方案
推荐阅读
- css - 导航栏子元素忽略 css 规则
- python - 从 html 源代码中抓取“数据价格”
- java - 返回基于 SQL 的动态数组
- python-3.x - 如何使用散景绘制具有不同类型虚线的单线?
- sql - 选择多个表中的 ID 数(从三个表中)
- codeigniter - codeigniter 在 where 子句中使用 concat 正则表达式
- sql - 需要加入但在辅助表上
- c++ - 我不明白如何正确使用 set_difference
- c# - 如何在 dbcontext 中访问令牌的数据
- c++ - 无法编译:对`boost::filesystem::detail::directory_iterator_construct 的未定义引用