I have many items in the listView, each item in the listView has an HorizontalScrollView. When I scroll one item, all the other items in the listView should scroll itself. How can I implement this? The code for my listview is
<?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:id="@+id/admin_ip_listView"
android:padding="15dp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView_ip_picture"
android:background="@mipmap/ic_launcher_round"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView_ip_ref_number"
/>
<HorizontalScrollView
android:layout_width="900dp"
android:layout_height="wrap_content"
android:scrollbars="horizontal">
<LinearLayout
android:layout_width="900dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView_ip_q1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView_ip_q2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView_ip_q3"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView_ip_q4"/>
</LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/texview_ip_avg"/>
</LinearLayout>
Thanks!
Will this be helpful if you put your list view inside horizontal scrollview itself setting
listview.canScrollVertically(false)
?
But why you fix android:layout_width with 900dp in HorizontalScrollView and LinearLayout?
Can you try to change: layout_width
like this:
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
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.