我想创建列表视图,能够水平和垂直滚动。图像显示列表视图中的行项目。一切都应该作为正常的列表视图 - 垂直滚动的能力。
除了标题( Teszt Elk Nev )行中的其余数据也应该水平滚动。(正如您在图像上看到的 - 第二行)当我水平滚动时,列表视图中的所有行都应该水平滚动,因此所有行都具有相同的水平滚动位置。
我花了几个小时试图解决它。迄今为止最好的解决方案是水平滚动只有一行。我的行项目布局代码。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/tvOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginRight="30dp"
android:text="one" />
<com.example.testproject.CustomHorScroll
android:id="@+id/myHorScroll"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/myLay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="70dp"
android:text="two" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="70dp"
android:text="three" />
<!-- rest items goes here --!>
</LinearLayout>
</com.example.testproject.CustomHorScroll>
</LinearLayout>
我想处理水平滚动移动并传播到列表视图中的所有行以设置水平滚动视图.scrollBy(x,0)。但我不能让它工作。:/
另一个想法是跳过列表视图并使用滚动视图和水平滚动创建自定义布局。