我喜欢 Android 偏好类别中的标题栏样式。
在我的 Activity (not a PreferenceActivity
) 中如何使用相同的样式?
我喜欢 Android 偏好类别中的标题栏样式。
在我的 Activity (not a PreferenceActivity
) 中如何使用相同的样式?
由于我刚刚花了最后几个小时试图回答这个老问题,所以我会在这里为其他人做。事实证明,偏好类别样式使用的资源是 listSeparatorTextViewStyle。
你像这样使用它:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello, World"
style="?android:attr/listSeparatorTextViewStyle"/>
使用style="?android:attr/preferenceCategoryStyle"
无效。
主布局很可能是带有 LinearLayout 的 ScrollView。至于个人布局,我相信(只是在查看文档后猜测)您可以使用 android.R.attr 中的各种属性 - 看这里:http: //developer.android.com/reference/android/R。 attr.html。有诸如preferenceCategoryStyle、preferenceStyle 等属性。您可以将任何样式应用于任何视图。