Android中水平滚动视图中的宽垂直列表视图
我的Android应用程序中有一个垂直列表视图 它的样式类似于带有列的表,即每个listview项模板在水平线性布局中有多个文本视图。每个文本视图都有一个宽度,例如12个文本视图,每个200dp表示listview的宽度需要为2400dp 此listview需要垂直滚动,这很好,因为这是listview的内置功能。然而,由于listview的宽度很大,我需要它也可以水平滚动,因为我不想在TextView上使用权重,也不想在屏幕宽度上使用squish 我想把listview放在水平滚动视图中。然后将listview上的宽度设置为2400dp,并将水平scollview宽度设置为与\u父级匹配 但是,scrollview似乎没有扩展到足以显示listview的全部宽度。它水平滚动,但不够。这种方法哪里出了问题 在页面中: 列表视图项Android中水平滚动视图中的宽垂直列表视图,android,listview,scroll,xamarin,Android,Listview,Scroll,Xamarin,我的Android应用程序中有一个垂直列表视图 它的样式类似于带有列的表,即每个listview项模板在水平线性布局中有多个文本视图。每个文本视图都有一个宽度,例如12个文本视图,每个200dp表示listview的宽度需要为2400dp 此listview需要垂直滚动,这很好,因为这是listview的内置功能。然而,由于listview的宽度很大,我需要它也可以水平滚动,因为我不想在TextView上使用权重,也不想在屏幕宽度上使用squish 我想把listview放在水平滚动视图中。然后
里面的文本视图加起来正好是2400dp,你给listview的宽度正好是2400dp,但是我认为listview本身需要一些dp,例如,小滚动条垂直滚动项目,我假设这是你缺少的像素
<HorizontalScrollView
android:layout_height="match_parent"
android:layout_width="match_parent">
<ListView
android:layout_height="match_parent"
android:layout_width="2400dp"/>
</HorizontalScrollView>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
<TextView
android:text="Long text here..."
android:layout_width="200dp"
android:layout_height="match_parent"/>
</LinearLayout>