I have a certain problem in my Activity. The ScrollView doesn't scroll down to the bottom.
I have a screenshot for you.
我在活动中遇到了一些问题。滚动视图不会向下滚动到底部。我有一个截图给你。
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的滚动条,可以看到它并没有向下滚动到底部。以下是scrollView的XML布局:
<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?
我怎样才能修好它呢?
3 个解决方案
#1
104
The problem is android:layout_margin="10dp" in RelativeLayout of SrcollView
问题是android:layout_margin=“10dp”在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" >
#2
3
use in scrollView xml
在滚动视图中使用xml
android:paddingBottom="10dp"
it'll shift content of scroll view to 10 dp upward not the VIEW.
它会将滚动视图的内容向上移动到10dp而不是视图。
#3
-2
This may be problem with your layout design. if you add the margin for the view then it will be visible clearly. so
这可能是布局设计的问题。如果您为视图添加空白,那么它将清晰可见。所以
In scrollview add
在滚动视图添加
android:layout_marginBottom="30dp"
#1
104
The problem is android:layout_margin="10dp" in RelativeLayout of SrcollView
问题是android:layout_margin=“10dp”在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" >
#2
3
use in scrollView xml
在滚动视图中使用xml
android:paddingBottom="10dp"
it'll shift content of scroll view to 10 dp upward not the VIEW.
它会将滚动视图的内容向上移动到10dp而不是视图。
#3
-2
This may be problem with your layout design. if you add the margin for the view then it will be visible clearly. so
这可能是布局设计的问题。如果您为视图添加空白,那么它将清晰可见。所以
In scrollview add
在滚动视图添加
android:layout_marginBottom="30dp"