Coder
Coder

Reputation: 3130

Android - Scrolling within RelativeLayout

The scroll view does not show the full text. It gets cutoff by couple of lines. I dont want to include the button in scrollview, it should always stay at the bottom. Any workaround for this?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ffffff">

    <ScrollView
        android:id="@+id/details_view"
        android:layout_width="match_parent"
        android:fillViewport="true"
        android:layout_height="wrap_content">

        <RelativeLayout
            android:id="@+id/details_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingTop="@dimen/activity_vertical_margin">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/provider_logo" />

            <TextView
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:paddingRight="@dimen/activity_horizontal_margin"
                android:id="@+id/details_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textSize="18sp"
                android:layout_below="@id/provider_logo"
                android:textStyle="bold"
                android:layout_marginTop="10dp"
                android:textColor="@color/colorPrimary"/>


            <TextView
                android:id="@+id/details_description"
                android:layout_below="@id/details_heading"
                android:singleLine="false"
                android:lineSpacingMultiplier="1.3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:paddingRight="@dimen/activity_horizontal_margin"
                android:textSize="16sp"
                android:text="Lorem Ipsum is simply dummy text of the printing and Lorem Ipsum is simply dummy text of the printing and Lorem Ipsum is simply dummy text of the printing and Lorem Ipsum is simply dummy text of the printing and Lorem Ipsum is simply dummy text of the printing andLorem Ipsum is simply dummy text of the printing andLorem Ipsum is simply dummy text of the printing and"
                android:layout_marginTop="10dp"
                android:textColor="@color/text_grey"/>

        </RelativeLayout>

    </ScrollView>

    <android.support.v7.widget.AppCompatButton
        android:id="@+id/details_call_button"
        style="?android:textAppearanceSmall"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textStyle="bold"
        android:background="@color/colorPrimary"
        android:textColor="@color/white"
        android:layout_alignParentBottom="true"
        />

</RelativeLayout>

Upvotes: 0

Views: 52

Answers (1)

Coder
Coder

Reputation: 3130

I added android:layout_above="@+id/details_call_button in ScrollView tag and it seems to work.

Upvotes: 1

Related Questions