android - 无法在 tablayout 顶部隐藏行
问题描述
安卓工作室 3.5
我想在底部显示带有阴影的 Tablayout。所以我试试这个:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/appbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/balanceTitleContainer"
style="@style/ImpressiveCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/default_gap"
android:layout_marginEnd="@dimen/default_gap">
<LinearLayout
android:id="@+id/baseTokenContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/baseTokenTokenView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="19sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_gap"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/topUpButton"
style="@style/PrimaryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_weight="0.5"
android:text="@string/topUp"
android:textSize="12sp"
android:theme="@style/PrimaryButton.Overlay" />
<Button
android:id="@+id/sendButton"
style="@style/PrimaryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:layout_weight="0.5"
android:text="@string/send"
android:textSize="12sp"
android:theme="@style/PrimaryButton.Overlay" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:elevation="@dimen/line_divider_shadow_height"
app:tabMode="scrollable"
app:tabTextColor="@color/colorAccent">
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/my_vauchers" />
</android.support.design.widget.TabLayout>
应用栏布局 xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/appbar"
style="@style/AppbarTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/toolbar" />
</android.support.design.widget.AppBarLayout>
我用
android:background="@color/white"
android:elevation="@dimen/line_divider_shadow_height"
显示阴影。
这里的结果:
正如您在 Tablayout 中看到的,顶部也显示灰线(在My Vaucher上方)。但我只需要 Tablayout 底部的灰线(阴影)。
解决方案
推荐阅读
- python - 在 Python 中减少值
- javascript - 加载资源失败:服务器响应状态为 500(内部服务器错误)
- ios - iPhone 11 应用顶部和底部的 Expo React Native 额外空间
- react-native - 使用 react native 在 android studio 中构建 Gradle 失败
- wpf - WPF - 在 ItemsControl 中设置 DataGrid 的初始大小
- ios - 如何从 VC 调用导航控制器
- doctrine-orm - 如何使用 Doctrine 更改列字符集和排序规则?
- python - 预提交运行 unittest git hooks: ModuleNotFoundError for installed python module in environment
- python-3.x - 没有使用 Folium 渲染 GeoJSON 文件
- javascript - 我可以在 html 图像区域地图中创建半圆形吗?