I'm learning the android. I created a simple xml screen but data is going out of screen and the screen is not scrolling. Can any body tell me how to make scrollable my phone screen?
Put it inside a ScrollView
http://developer.android.com/reference/android/widget/ScrollView.html
Here is some code for a fixed header and fixed footer and a scrolling 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>
Have fun.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With