Scrollable layout in Android

Vikas Patidar picture Vikas Patidar · Nov 17, 2010 · Viewed 45.1k times · Source

I have a registration form in a LinearLayout as shown below:

alt text

When emulator screen is in it's default position it is working fine. But when I rotate the emulator screen it only displays the elements which are fit to screen and remaining are wrap up. As shown in below screen: alt text

Now I want to make this layout scrollable but not getting the idea. Any help will be highly appreciated.

Answer

Fredrik Wallenius picture Fredrik Wallenius · Nov 17, 2010

Try putting your LinearLayout inside an ScrollView like this:

<?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:id="@+id/menu_ll"
        android:layout_width="fill_parent" android:layout_height="fill_parent"></LinearLayout>

</ScrollView>