【发布时间】:2020-01-29 04:02:30
【问题描述】:
我为我的项目创建了几个 CardView 并注意到我的页面不可滚动,我搜索并找到了一些方法,例如将 RelativeLayout 更改为 ScrollView 但是当我运行我的应用程序时它崩溃了我的主要活动 java。所以我决定把它改回来,把ScrollView放在我的LinearLayout上面,它可以工作,但是我最后一个CardView没有完全显示,有些部分隐藏在底部导航后面。有人可以帮助我或启发我如何在我的 xml 文件中实现 ScrollView 吗?
<RelativeLayout 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:background="@color/white"
android:orientation="vertical"
tools:context=".MainActivity">
<com.google.android.material.bottomnavigation.BottomNavigationView ...>
<LinearLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/btm_nav"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar...>
<technolifestyle.com.imageslider.FlipperLayout ...>
<androidx.cardview.widget.CardView ...>
<androidx.cardview.widget.CardView ...>
<androidx.cardview.widget.CardView ...>
</LinearLayout>
</RelativeLayout>
【问题讨论】:
标签: android xml scrollview android-relativelayout