Android ScrollView滚动条大小 [英] Android ScrollView Scrollbar Size
本文介绍了Android ScrollView滚动条大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ScrollView,并且我想设置ScrollBar的大小,但是我尝试的所有操作均失败了. 我尝试使用属性android:scrollbarSize,样式,主题,但一无所获.滚动条的大小始终相同. 有什么建议?谢谢
I'm using a ScrollView and I want to set the ScrollBar size, but everything I tried failed. I tried with attribute android:scrollbarSize, with style, with the theme but nothing. The size of the scrollbar it's always the same. Any suggestions? Thanks
我尝试过:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10px"
android:layout_marginBottom="15px"
android:scrollbarSize="20px"
android:scrollbarTrackVertical="@drawable/scrollbar_reflection"
android:scrollbarThumbVertical="@drawable/scrollbar_state2">
但滚动条的宽度不变.
所以我创建了一个这样的样式文件:
So I created a style file like this:
<resources>
<style name="ShowAllScrollBar1">
<item name="android:scrollbarSize">20px</item>
</style>
</resources>
,然后在AndroidManifest中设置样式.
and then set style in AndroidManifest.
推荐答案
尝试同时实现 android:scrollbarThumbVertical
和 android:scrollbarSize="1dp"
,您的问题将得到解决 ScrollView , RecyclerView .
请参阅以下代码段
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10px"
android:layout_marginBottom="15px"
android:scrollbars="vertical"
android:scrollbarThumbVertical="@color/colorPrimaryDark"
android:scrollbarSize="1dp">
对于 HorizontalScrollView:
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10px"
android:layout_marginBottom="15px"
android:scrollbars="horizontal"
android:scrollbarThumbHorizontal="@color/colorPrimaryDark"
android:scrollbarSize="1dp">
这篇关于Android ScrollView滚动条大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文