1 回答

TA貢獻(xiàn)1946條經(jīng)驗(yàn) 獲得超3個(gè)贊
使用此自定義 PreferenceCategory 類:
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);
}
}
并將其添加到您的 Pref.xml 文件中:
<ali.UI.Customize.MyPreferenceCategory android:title="@string/pref_server" />
方法 2:一種簡(jiǎn)單的方法是在此處設(shè)置自定義布局preferenceCategory:
<PreferenceCategory
android:layout="@layout/preferences_category"
android:title="Privacy">
一種簡(jiǎn)單的方法是在此處為 preferenceCategory 設(shè)置自定義布局:
<PreferenceCategory
android:layout="@layout/preferences_category"
android:title="Privacy" >
然后在布局文件中設(shè)置代碼preferences_category:
<TextView
android:id="@android:id/title"
android:textColor="@color/deep_orange_500"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:textAllCaps="true"/>
添加回答
舉報(bào)