Change text color and horizontal color for preference category in android -
i change color of preference category , change default horizontal line blue. possible?
i tried setting theme preference settings following:
<style name="mypreferencetheme" parent="@style/appbasetheme"> <item name="android:textcolor">@color/blue</item> </style>
but got following output:
my preference.xml looks this:
<preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" > <preferencecategory android:title="account" > <preference android:key="googleaccount" android:summary="" android:title="google account" > </preference> <preference android:key="signoutmenu" android:summary="" android:title="sign out" > </preference> </preferencescreen>
can me fix issue show in screenshot above?
thanks!
you can create custom preferencecategory , change title color on "onbindview" method (in example category title color changed red).
public class mypreferencecategory extends preferencecategory { public mypreferencecategory(context context) { super(context); } public mypreferencecategory(context context, attributeset attrs) { super(context, attrs); } public mypreferencecategory(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); } @override protected void onbindview(view view) { super.onbindview(view); textview titleview = (textview) view.findviewbyid(android.r.id.title); titleview.settextcolor(color.red); }
}
Comments
Post a Comment