Reputation: 7421
Below is the layout file of the bottom sheet. I have a TextView
below the nested scroll view. When the content is large, the TextView
below the NestedScrollView
is not visible. If content of NestedScrollView is small it is visible. I am not getting what's causing this.
Here is my layout file:
<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 is inflated on Runtime. There are some reasons I am not using RecyclerView
or ListView
. This is fairly small, Just a little scrolling sometime.
But the TextView list_description
is not being displayed when list_container
is large (needs scrolling).
I am not getting it what's going wrong.
Upvotes: 2
Views: 1960
Reputation: 699
Try using android:layout_weight
on your NestedScrollView
.
In your case, replace the header of your NestedScrollView
with:
<android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"
Hope that helps =]
Upvotes: 3