Android - 在RelativeLayout中滚动

时间:2016-09-19 09:29:57

标签: android android-layout scrollview

滚动视图不显示全文。它被几行线切断了。 我不想在scrollview中包含按钮,它应该始终保持在底部。对此有何解决方法?

<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>

1 个答案:

答案 0 :(得分:1)

我在 ScrollView 标记中添加了android:layout_above="@+id/details_call_button,它似乎有效。