DarkWing89
DarkWing89

Reputation: 309

Make View Scrollable because hidden text

I have an Activity with 2 LinearLayouts vertical in the screen and 1-2 buttons in the bottom right corner.

Depending on the length of the LinearLayouts it could happen that the text in the Layouts is hidden from the Button. Hence i would like to make the Activity always scrollable that the User is able to drag the LinearLayouts a bit up and read the text.

Here is a little Visualization:

enter image description here

I tried it with some solutions i found on the web but its not working:

first try:

<ConstraintLayout>
    <LinearLayout>...</LinearLayout>
    <LinearLayout>...</LinearLayout>
    <Button>...</Button>
<ConstraintLayout>

second try:

<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">
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
                <LinearLayout>...</LinearLayout>
                <LinearLayout>...</LinearLayout>
        </LinearLayout>
    </ScrollView>
    <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true">
           <Button .... />
    </RelativeLayout>
</RelativeLayout>

Upvotes: 0

Views: 37

Answers (1)

Nariman Ermekov
Nariman Ermekov

Reputation: 305

Try to add Padding Bottom

<LinearLayout
            android:padding_bottom="50dp"
            />

Upvotes: 1

Related Questions