简体   繁体   English

使Listview(项目具有weight属性)可以水平滚动

[英]Make Listview (item has weight property) Horizontally scrollable

Horizontal Scrollview can be used for listview to make it scroll both side. Horizontal Scrollview滚动视图可用于列表视图以使其向两侧滚动。

But my listview item is: 但是我的列表视图项是:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:id="@+id/textView87" />
     <TextView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:id="@+id/textView88" />
     <TextView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:id="@+id/textView89" />
     <TextView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:id="@+id/textView90" />

</LinearLayout>

What I want : Consider the first textview. 我想要的是:考虑第一个textview。 In all the rows, I need that textview width as same. 在所有行中,我都需要相同的textview宽度。 (Same for all textviews) (所有textview相同)

Is there anyway to do this. 反正有做到这一点。 Please help me!!! 请帮我!!!

Try this 尝试这个

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:weightSum="4"
android:layout_height="wrap_content">
<TextView
    android:layout_width="0dp"
    android:layout_weight="1"
    android:layout_height="match_parent"
    android:id="@+id/textView87" />
 <TextView
    android:layout_width="0dp"
    android:layout_weight="1"
    android:layout_height="match_parent"
    android:id="@+id/textView88" />
 <TextView
    android:layout_width="0dp"
    android:layout_weight="1"
    android:layout_height="match_parent"
    android:id="@+id/textView89" />
 <TextView
    android:layout_width="0dp"
    android:layout_weight="1"
    android:layout_height="match_parent"
    android:id="@+id/textView90" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM