Android ListView。垂直滚动条不是';对于宽列表,不总是可见
我有比父视图更宽的ListView。为了进行水平滚动,我用HorizontalScrollView将其包装起来 简化布局XML:Android ListView。垂直滚动条不是';对于宽列表,不总是可见,android,listview,android-listview,Android,Listview,Android Listview,我有比父视图更宽的ListView。为了进行水平滚动,我用HorizontalScrollView将其包装起来 简化布局XML: <HorizontalScrollView android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:id="@+id/main" android:lay
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/children"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</RelativeLayout>
</HorizontalScrollView>
因此,在ListView中有垂直滚动条,在HorizontalScrollView中有水平滚动条
我的问题是,除非水平滚动视图没有滚动到最右边的位置,否则我看不到垂直列表滚动条。因为垂直滚动条沿着ListView的右边缘
有没有办法使垂直滚动条沿着HorizontalScrollView的右边缘可见?
要使列表垂直滚动条在任何水平滚动视图位置可见,请尝试以下操作:
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none">
<LinearLayout android:id="@+id/main"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal">
<ListView android:id="@+id/children"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</HorizontalScrollView>
试试这个:
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none">
<LinearLayout android:id="@+id/main"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal">
<ListView android:id="@+id/children"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</HorizontalScrollView>
谢谢您的回答。我已经试过你的代码了。但这没用(结果只有水平滚动条消失了。谢谢您的回答。我已经尝试了您的代码。但没有帮助。)(结果只有水平滚动条消失了。您是否找到了此问题的解决方案?我的应用程序中的一个组件遇到了相同的问题。如果有一种内置方法可以保持垂直条始终可见,我想利用它。不幸的是,我没有找到解决方案:(您是否找到了此问题的解决方案?我的应用程序中的一个组件遇到了相同的问题。如果有一种内置方法可以始终保持垂直条可见,我希望利用它。不幸的是,我没有找到解决方案:(