Reputation: 1561
I have a view with three linear layouts and listview.I want to scroll the entire view while scrolling the list.Is it possible? Scrollview not worked.Please help me .thanks in advance
layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical" >
<LinearLayout
android:layout_width="185dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:orientation="vertical" >
<TextView
android:id="@+id/txt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/black" />
<TextView
android:id="@+id/txt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#9d9d97" />
</LinearLayout>
<LinearLayout
android:layout_width="185dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:orientation="vertical" >
<TextView
android:id="@+id/txt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#9d9d97" />
<TextView
android:id="@+id/txt4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#9d9d97" />
</LinearLayout>
<LinearLayout
android:layout_width="185dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:orientation="vertical" >
<TextView
android:id="@+id/txt5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="30"
android:textColor="#9d9d97"
android:textSize="13sp" />
<TextView
android:id="@+id/txt6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#9d9d97" />
</LinearLayout>
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:cacheColorHint="@color/white"
android:dividerHeight="1.0sp"
android:fillViewport="true"
android:longClickable="true" >
</ListView>
</LinearLayout>
Upvotes: 0
Views: 53
Reputation: 22232
Putting ListView
inside ScrollView
is not a good idea.
Either make your three LinearLayouts
headers like here: http://www.vogella.com/articles/AndroidListView/article.html#miscellaneous_headerfooter or make them part of the adapter using getViewTypeCount
and getItemViewType
and returning them from getView
: getViewTypeCount and getItemViewType methods of ArrayAdapter.
Upvotes: 2