Emulate android preference category look/feel
I like the title bar style from the Android preference category.
In my Activity (not a PreferenceActivity
) How can I use th开发者_JAVA技巧e same style?
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:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello, World"
style="?android:attr/listSeparatorTextViewStyle"/>
Using style="?android:attr/preferenceCategoryStyle"
didn't work.
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.
精彩评论