How to make my layout able to scroll down?

I can’t scroll down to view the data in the “Answered:” section. How can I make my layout scrollable?

alt text

+66
android layout
Sep 29 '10 at 6:17
source share
3 answers

Just wrap it all inside a ScrollView :

 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- Here you put the rest of your current view--> </ScrollView> 

As David Hedlund said, ScrollView can only contain one element ... so if you have something like this:

 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- bla bla bla--> </LinearLayout> 

You must change it to:

 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- bla bla bla--> </LinearLayout> </ScrollView> 
+146
Sep 29 '10 at 6:19 06:19
source share

To view the scroll along with the Relative layout:

 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true"> <!--IMPORTANT otherwise backgrnd img. will not fill the whole screen --> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:background="@drawable/background_image" > <!-- Bla Bla Bla ie Your Textviews/Buttons etc. --> </RelativeLayout> </ScrollView> 
+27
Jun 11 '13 at 4:20
source share

If you didn’t even get a scroll after doing what is written above ...

Set android:layout_height="250dp" or you can say xdp , where x can be any numerical value.

0
Aug 31 '16 at 12:28
source share



All Articles