Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollable layout in Android

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.

like image 598
Vikas Patidar Avatar asked Nov 17 '10 07:11

Vikas Patidar


People also ask

What is scroll layout android?

In Android, a ScrollView is a view group that is used to make vertically scrollable views. A scroll view contains a single direct child only. In order to place multiple views in the scroll view, one needs to make a view group(like LinearLayout) as a direct child and then we can define many views inside it.

Is linear layout scrollable android?

You need to place ScrollView as the first child of Layout file and now put your linearlayout inside it. Now, android will decide on the basis of content and device size available whether to show a scrollable or not. Make sure linearlayout has no sibling because ScrollView can not have more than one child.


1 Answers

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> 
like image 147
Fredrik Wallenius Avatar answered Oct 12 '22 07:10

Fredrik Wallenius