第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何在 Androidx 中更改偏好的文本顏色

如何在 Androidx 中更改偏好的文本顏色

忽然笑 2023-06-21 14:50:20
我想在 Preference.xml 文件中更改 Preference 的文本顏色XML代碼<?xml version="1.0" encoding="utf-8"?><androidx.preference.PreferenceScreen    xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto">    <androidx.preference.Preference        android:key="pref_entries"        android:title="@string/settings_entries"        android:summary="0"        android:enabled="true"        app:iconSpaceReserved="false" /></androidx.preference.PreferenceScreen>我嘗試在 xml 文件中添加 textcolor 但它不起作用Java代碼 prefEntries = pm.findPreference(Const.PREF_ENTRIES);如何更改首選文本顏色
查看完整描述

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"/>


查看完整回答
反對(duì) 回復(fù) 2023-06-21
  • 1 回答
  • 0 關(guān)注
  • 147 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)