模拟 Android 偏好类别的外观/感觉
我喜欢 Android 首选项类别中的标题栏样式。
在我的 Activity(不是 PreferenceActivity
)中,如何使用相同的样式?
I like the title bar style from the Android preference category.
In my Activity (not a PreferenceActivity
) How can I use the same style?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于我刚刚花了最后几个小时试图回答这个老问题,所以我会在这里为其他人做这件事。
事实证明,首选项类别样式使用的资源是 listSeparatorTextViewStyle。
您可以这样使用它:
使用
style="?android:attr/preferenceCategoryStyle"
不起作用。Since I just spent the last few hours trying to answer this old question, I'll do it here for anyone else.
It turns out the resource the preference category style is using is listSeparatorTextViewStyle.
You use it like this:
Using
style="?android:attr/preferenceCategoryStyle"
didn't work.主要布局很可能是带有 LinearLayout 的 ScrollView。至于单独的布局,我相信(只是在查看文档后猜测)您可以使用 android.R.attr 中的各种属性 - 请看这里: http://developer.android.com/reference/android/R.attr.html。有一些属性,例如preferenceCategoryStyle、preferenceStyle 等。您可以将任何样式应用到任何视图。
The main layout is most likely a ScrollView with a LinearLayout. As for the individual layout, I believe (just guessing after looking at the documentation) that you can use the various attributes in android.R.attr - look here: http://developer.android.com/reference/android/R.attr.html. There are attributes like preferenceCategoryStyle, preferenceStyle, etc. You can apply any style to any of your views.