I am making an android application that needs to use a scrollable layout that contains a couple of linearlayouts, a textview and a listview. How can i make this happen??? Please help and thanks SO much in advance! This is the xml code that i am using so far:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<TextView
android:id="@+id/NotesWelcomeTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/NotesWelcomeText" />
<ListView
android:id="@+android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView>
<LinearLayout
android:id="@+id/DeleteAllItemsFromListViewLinearLayout"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:visibility="invisible" >
<Button
android:id="@+id/CancelButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Cancel" />
<Button
android:id="@+id/DeleteAllButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Delete" />
</LinearLayout>
<LinearLayout
android:id="@+id/DeleteItemFromListViewLinearLayout"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:visibility="invisible" >
<Button
android:id="@+id/CancelButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Cancel" />
<Button
android:id="@+id/DeleteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Delete" />
</LinearLayout>
<LinearLayout
android:id="@+id/AddItemToListViewLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone" >
<EditText
android:id="@+id/AddItemToListViewEditText"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
</EditText>
<Button
android:id="@+id/AddItemToListViewButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/Add" />
</LinearLayout>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:text="@string/terms_and_conditions" />
</ScrollView>
Make your main layout as scroll layout inside that put the linear layout.
Keep in mind Scroll layout can hold only one type of item...
Once you do this, the whole layout is scroll able up and down or left and right as per your XML config.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.