Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
288 views
in Technique[技术] by (71.8m points)

android - ScrollView doesn't scroll to the bottom

I have a certain problem in my Activity. The ScrollView doesn't scroll down to the bottom.
I have a screenshot for you. enter image description here

If you look at the scrollbar of the scrollView, you can see that it's not scrolling down to the bottom.
Here's my XML layout of the scrollView:

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:fillViewport="true"
    android:layout_below="@+id/step2_header" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp" >

        <TextView
            android:id="@+id/step2_headerText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:gravity="center"
            android:text="@string/Schritt2"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/dark_blue"
            android:textStyle="bold|italic" />

        <ImageView
            android:id="@+id/step2_image"
            android:layout_width="wrap_content"
            android:layout_height="100dp"
            android:layout_below="@+id/step2_headerText"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_marginTop="10dp"
            android:src="@drawable/menu_leiste" />

        <TextView
            android:id="@+id/step2_infoText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/step2_image"
            android:text="@string/step2Text"
            android:textAppearance="?android:attr/textAppearanceSmall" />

       <ImageView
            android:id="@+id/step2_but1Img"
            android:layout_width="match_parent"
            android:layout_height="35dp"
            android:layout_below="@+id/step2_infoText"
            android:layout_marginTop="10dp"
            android:src="@drawable/menu_leiste_selector" />

        <TextView
            android:id="@+id/step2_but1Text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/step2_but1Img"
            android:layout_alignParentLeft="true"
            android:layout_alignTop="@+id/step2_but1Img"
            android:layout_marginLeft="10dp"
            android:gravity="center"
            android:text="@string/step2But1Text"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/white" />

        <ImageView
            android:id="@+id/step2_but1ArrowImg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="3dp"
            android:layout_alignBottom="@+id/step2_but1Img"
            android:layout_alignParentRight="true"
            android:layout_alignTop="@+id/step2_but1Img"
            android:src="@drawable/location_web_site" />

        <ImageView
            android:id="@+id/step2_but2Img"
            android:layout_width="match_parent"
            android:layout_height="35dp"
            android:layout_below="@+id/step2_but1Img"
            android:layout_marginTop="10dp"
            android:src="@drawable/menu_leiste_selector" />

        <TextView
            android:id="@+id/step2_but2Text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/step2_but2Img"
            android:layout_alignParentLeft="true"
            android:layout_alignTop="@+id/step2_but2Img"
            android:layout_marginLeft="10dp"
            android:gravity="center"
            android:text="@string/step2But2Text"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/white" />

        <ImageView
            android:id="@+id/step2_but2ArrowImg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="3dp"
            android:layout_alignBottom="@+id/step2_but2Img"
            android:layout_alignParentRight="true"
            android:layout_alignTop="@+id/step2_but2Img"
            android:src="@drawable/location_web_site" />

    </RelativeLayout>

</ScrollView>

How can I fix it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem is android:layout_margin="10dp" in RelativeLayout of SrcollView

Replace

 <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp">

with

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp" >

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...