Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable scrolling functionality to linear layout in android?

Can anyone help me how to enable scrolling functionality for linearlayout?

like image 395
sathish Avatar asked Jun 10 '11 11:06

sathish


People also ask

Can I make a linear layout scrollable?

You cannot make a LinearLayout scrollable because it is not a scrollable container. Only scrollable containers such as ScrollView, HorizontalScrollView, ListView, GridView, ExpandableListView can be made scrollable.

How do I add a scroll to linear layout?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. In this above code, we have declare Linear layout as parent and added Vertical Scroll view.

How do I make my android activity scrollable?

You can make your activity scrollable using ScrollView. Its very simple and effective to use. Just copy code of ScrollView from below and paste it in your layout xml file. You can use this ScrollView with Linear as well as Relative Layout also.

Can scroll vertically 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.


2 Answers

Use a ScrollView ?

<LinearLayout android:id="@+id/LinearLayout01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <ScrollView android:id="@+id/ScrollView01"
                android:layout_width="fill_parent"
                android:layout_height="110px">
    </ScrollView>
</LinearLayout>
like image 147
Reno Avatar answered Sep 21 '22 21:09

Reno


You can put anything inside a scroll view to make something (LinearLayout, RelativeLayout and etc) scrollable. You can follow http://www.androidpeople.com/android-scrollview-example for more details.

like image 20
Ye Myat Min Avatar answered Sep 17 '22 21:09

Ye Myat Min