In this application i tag the data using json parsing and binding the data using list adapter and i was add the heading for data in static using table layout, when i scroll horizontally the data scroll with heading but horizontal scroll view only allowed to only one child, i need two layout in single horizontal scroll view. please help
my xml is
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical">
<!-- Main ListView Always give id value as list(@android:id/list) -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="horizontal">
<TableRow
android:id="@+id/tableRow1"
android:scrollbarAlwaysDrawHorizontalTrack="true"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<TextView
android:id="@+id/TextView2"
android:text="GRPName"
android:background="#A513FF"
android:textColor="#000000"
android:layout_width="150dp"
android:padding="3dip"
android:gravity="left"/>
<TextView
android:id="@+id/TextView3" android:text="NAME"
android:background="#A513FF"
android:textColor="#000000"
android:layout_width="100dp"
android:padding="3dip" android:gravity="left"/>
<TextView
android:id="@+id/TextView4" android:text="MRP"
android:background="#A513FF"
android:textColor="#000000"
android:layout_width="100dp"
android:padding="3dip" android:gravity="left"/>
<TextView
android:id="@+id/TextView5" android:text="QNT"
android:background="#A513FF"
android:textColor="#000000"
android:layout_width="100dp"
android:padding="3dip" android:gravity="left"/>
<TextView
android:id="@+id/TextView2" android:text="ID"
android:background="#A513FF"
android:textColor="#000000"
android:layout_width="100dp"
android:padding="3dip"
android:gravity="left"/>
<TextView
android:id="@+id/TextView3" android:text="NAME"
android:background="#A513FF"
android:textColor="#000000"
android:layout_width="100dp"
android:padding="3dip" android:gravity="left"/>
</TableRow>
</LinearLayout>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/horizontalScrollView">
<ListView
android:id="@android:id/list"
android:smoothScrollbar="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</HorizontalScrollView>
</LinearLayout>
I need to table layout in the horizontal scroll view
You have to put one layout as a scrollviews child, then put every other views in that child and it should work fine.
Like this way:
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/horizontalScrollView">
<LinearLayout ... >
... insert your views in here
</LinearLayout>
</HorizontalScrollView>