始终显示 PreferenceScreen 的滚动条
我已经使用preferences.xml和PreferenceActivity在我的应用程序中定义了首选项。这些设置以类似 ScrollView 的方式呈现在手机中。我想始终显示垂直滚动条。在 Android 1.6 中,它们不会消失,但在 Android 2.2 中,它们会在大约一秒后消失。在 ScrollView 中,我可以使用 android:scrollbarAlwaysDrawVerticalTrack 或 android:scrollbarDefaultDelayBeforeFade 来控制它。如何使用首选项小部件执行此操作?
/P
I have defined preferences in my app using preferences.xml and a PreferenceActivity. The settings are presented in the phone in a ScrollView-like-way. I would like to always show the vertical scrollbars all the time. In Android 1.6 they do not fade away, but in Android 2.2 the fade away after about a second. In a ScrollView I can control this using android:scrollbarAlwaysDrawVerticalTrack or android:scrollbarDefaultDelayBeforeFade. How can I do this with the preference widget?
/P
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这适用于我的 Android 2.3.3 。
This worked for my Android 2.3.3 .
尝试这个,因为当我想对 TextView 执行此操作时,上述建议对我不起作用:
Try this as the above suggestions didn't work for me when I wanted to do this for a TextView:
在
PreferenceScreen
中尝试android:scrollbarAlwaysDrawVerticalTrack="true"
。Try
android:scrollbarAlwaysDrawVerticalTrack="true"
in thePreferenceScreen
.所以,嘿,这是一个非常丑陋的解决方案,但它很短而且很有效。
这样你就得到了。请注意,投掷可以吃掉触摸事件,这种情况很少见,但有点烦人 - 但可行。
So hey, this is a seriously ugly solution, but its short and it works.
So there you have it. Note that the fling can eat on-touch events, its rare but its a little annoying - but workable.
将其放在您想要始终显示滚动条的滚动条中:
我知道违反直觉,但它工作得很好。
Put this in the scroller that you want to show scrollbars all the time:
Counterintuitive, I know, but it works perfectly.