In my application I have some buttons and one list view with different layouts and the list view is in the last position.
My problem is I attached the ScrollView
as root layout so scrolling is done correctly. But the ListView
visible only one list item and not scrolled.
Layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/taskscrollviewid"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:scrollbars="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="@+id/txtdate"
android:layout_width="0dip"
android:layout_height="30px"
android:layout_weight="1"
android:background="@drawable/taskbuttonselector" />
<Button
android:id="@+id/btnTaskTimeid"
android:layout_width="0dip"
android:layout_height="30px"
android:layout_weight="1"
android:background="@drawable/taskbuttonselector" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<EditText
android:id="@+id/txtItem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/edittextselector"
android:drawableEnd="@drawable/inbox"
android:gravity="top|left"
android:hint="Enter task"
android:inputType="textMultiLine"
android:maxLines="5"
android:minLines="3"
android:scrollbars="vertical"
android:singleLine="false" />
<ImageButton
android:id="@+id/imagebuttonid"
android:layout_width="31dp"
android:layout_height="36dp"
android:layout_gravity="right|bottom"
android:background="@drawable/inbox" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="@+id/btnaddcategoryid"
android:layout_width="0dip"
android:layout_height="30px"
android:layout_weight="1"
android:background="@drawable/taskbuttonselector"
android:text="AddCategory" />
<Button
android:id="@+id/btnaddseverityid"
android:layout_width="0dip"
android:layout_height="30px"
android:layout_weight="1"
android:background="@drawable/taskbuttonselector"
android:text="AddSeverity" />
</LinearLayout>
<Button
android:id="@+id/btnadddb"
android:layout_width="250px"
android:layout_height="30px"
android:layout_gravity="center|center_horizontal"
android:layout_marginTop="10dp"
android:background="@drawable/taskbuttonselector"
android:text="Add This Task" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="@+id/fillbut"
android:layout_width="0dip"
android:layout_height="30px"
android:layout_weight="1"
android:background="@drawable/taskbuttonselector"
android:text="Remain Task" />
<Button
android:id="@+id/remainbut"
android:layout_width="0dip"
android:layout_height="30px"
android:layout_weight="1"
android:background="@drawable/taskbuttonselector"
android:text="Finish Task" />
</LinearLayout>
<ListView
android:id="@+id/listid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:clickable="true"
android:orientation="vertical" >
</ListView>
</LinearLayout>
</ScrollView>
Add
android:layout_marginLeft="10dp"
android:layout_height = "200dp"
to your ListView