How to scroll the screen in android

I am learning android. I created a simple xml screen, but the data goes beyond the screen and the screen does not scroll. Can any body tell me how to make the scroll screen of my phone?

+4
source share
4 answers

Here is the code for a fixed header and fixed footer and scroll body:

 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:id="@+id/relativeLayout1" android:layout_width="wrap_content"> <TextView android:text="Header" android:id="@+id/textViewHeader" android:layout_width="wrap_content" android:layout_height="wrap_content"> </TextView> <TextView android:layout_alignParentBottom="true" android:text="Footer" android:id="@+id/textViewFooter" android:layout_width="wrap_content" android:layout_height="wrap_content"> </TextView> <ScrollView android:layout_above="@id/textViewFooter" android:layout_below="@id/textViewHeader" android:layout_height="fill_parent" android:layout_width="fill_parent" > <LinearLayout android:layout_below="@id/textViewHeader" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/about_tlh_body" android:id="@+id/textViewBody" android:layout_width="wrap_content" android:layout_height="wrap_content"> </TextView> </LinearLayout> </ScrollView> </RelativeLayout> 

Good luck.

+2
source

Do Your ListActivity Activity

Here is an example that implements listView / ListActivity

http://p-xr.com/android-tutorial-how-to-parseread-xml-data-into-android-listview/

Scroll to the end to find the Eclipse project to see the full implementation.

You can also use http://developer.android.com/reference/android/widget/ScrollView.html

0
source

Puth whole layout inside scrollView.ie topmost / parent layout - scrollview

0
source

All Articles