I have a registration form in a LinearLayout
as shown below:
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:
Now I want to make this layout scrollable but not getting the idea. Any help will be highly appreciated.
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.
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.
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>
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