下面是底页的布局文件。我有一个TextView
在嵌套滚动视图下方。当内容较大时,TextView
以下NestedScrollView
不可见。如果 NestedScrollView 的内容很小,它是可见的。我不明白是什么原因造成的。
这是我的布局文件:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/bottom_sheet_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="My Title">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="?attr/selectableItemBackgroundBorderless"
android:onClick="@{() -> handler.hideBottomSheet()}"
android:src="@drawable/ic_keyboard_arrow_down_black_24dp" />
</android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<RadioGroup
android:id="@+id/selection_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:checkedButton="@+id/mode_1"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:id="@+id/mode_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mode_1" />
<RadioButton
android:id="@+id/mode_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mode_2" />
</RadioGroup>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/list_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</android.support.v4.widget.NestedScrollView>
<TextView
android:id="@+id/list_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="This text is not visible. I dunno why! :/" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
list_container
LinerLayout 在运行时会膨胀。有一些原因我不使用RecyclerView
or ListView
。这是相当小的,有时只需滚动一下即可。
但是文本视图list_description
不显示时list_container
很大(需要滚动)。
我不明白出了什么问题。
尝试使用android:layout_weight
在你的NestedScrollView
.
在您的情况下,替换您的标题NestedScrollView
with:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
希望有帮助=]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)