我有一个比父视图更宽的ListView。为了实现水平滚动,我用HorizontalScrollView对其进行了包装。
简化的布局XML:
<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中有水平滚动条。
我的问题是,除非HorizontalScrollView没有滚动到最右边的位置,否则我看不到垂直列表滚动条。因为沿ListView右边缘的垂直滚动条。
有没有办法让垂直滚动条沿着HorizontalScrollView的右边缘可见?要使列表垂直滚动条在任何HorizontalScrollView位置可见,请执行以下操作。
发布于 2013-03-09 23:42:29
试着这样做:
<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>https://stackoverflow.com/questions/15312413
复制相似问题