Интересно, как я могу изменить этот цвет (синий банкомат «Установить номер телефона от партнера») на оранжевый, как показано ниже в поле ввода: цвет: #FF9900

enter image description here

Кто-нибудь знает как это сделать?

Изменить:

Я определил свой стиль следующим образом:

<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:windowTitleStyle">@style/DialogWindowTitle</item>
</style>

Вот стиль DialogWindowTitle:

<style name="DialogWindowTitle_Holo">
    <item name="android:maxLines">1</item>
    <item name="android:scrollHorizontally">true</item>
    <item name="android:textAppearance">@android:style/TextAppearance.Holo.DialogWindowTitle</item>
</style>

<style name="DialogWindowTitle" parent="@style/DialogWindowTitle_Holo">
    <item name="android:textAppearance">@style/TextAppearance.DialogWindowTitle</item>
    <item name="android:textColor">@drawable/actionbar_background</item>
</style>

<style name="TextAppearance.DialogWindowTitle" parent="android:TextAppearance.Holo.DialogWindowTitle">
    <item name="android:textColor">@drawable/actionbar_background</item>
</style>

У меня следующая деятельность:

public class SettingsActivity extends PreferenceActivity {

    @SuppressWarnings("deprecation")
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.settings);
    }
}

А это мои настройки.xml:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
    <PreferenceCategory android:title="@string/sectionTwoTitle" >
        <EditTextPreference
            android:title="@string/setPhoneNumber"
            android:summary="@string/setPhoneNumberSum"
            android:key="phoneNumber"/>
    </PreferenceCategory>
</PreferenceScreen>

Но это не работает. Есть идеи?

0
progNewbie 20 Апр 2015 в 03:01

2 ответа

Это хороший урок для вас (о стилях диалогов) http://blog.supenta .com/2014/07/02/how-to-style-alertdialogs-like-a-pro/

ИЛИ (последнее изменение) вы можете использовать настраиваемый диалог: 1-создать макет диалога:

CustomDialog.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/app"
        android:layout_toRightOf="@+id/app"
        android:layout_toEndOf="@+id/app"
    android:background="#00ff0700">


        <LinearLayout
            android:orientation="vertical"
            android:background="@drawable/bg_parent_rounded_corner_2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/linearLayout3">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="@string/details"
                android:id="@+id/textView6"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_margin="10dp"
                android:layout_row="0"
                android:layout_column="0"
                android:autoText="false"
                android:textColor="#0061C2" />

            <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/nom"
                    android:textSize="18dp"
                    android:id="@+id/nom"
                    android:layout_row="1"
                    android:layout_column="0"
                android:layout_marginLeft="10dp" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/prenom"
                android:textSize="18dp"
                android:id="@+id/prenom"
                android:layout_row="2"
                android:layout_column="0"
                android:layout_marginLeft="10dp" />

            <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/specialite"
                    android:textSize="18dp"
                    android:id="@+id/specialite"
                    android:layout_row="4"
                    android:layout_column="0"
                android:layout_marginLeft="10dp" />

            <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/numero"
                    android:textSize="18dp"
                    android:id="@+id/num_tel"
                    android:layout_row="3"
                    android:layout_column="0"
                android:layout_marginLeft="10dp" />

            <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/adresse"
                    android:textSize="18dp"
                    android:id="@+id/adresse"
                    android:layout_row="5"
                    android:layout_column="0"
                    android:layout_below="@+id/specialite"
                    android:layout_marginLeft="10dp" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/dispo"
                android:textSize="18dp"
                android:id="@+id/tvDispo"
                android:layout_row="1"
                android:layout_column="0"
                android:layout_marginLeft="10dp"
                android:visibility="visible" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/heures"
                android:textSize="18dp"
                android:id="@+id/tvHeures"
                android:layout_row="2"
                android:layout_column="0"
                android:layout_marginLeft="10dp"
                android:visibility="visible" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/listRdvDispo"
                android:textSize="18dp"
                android:id="@+id/tvJours"
                android:layout_row="3"
                android:layout_column="0"
                android:layout_marginLeft="10dp"
                android:visibility="visible" />

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <Button
                    android:id="@+id/OK"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/OK"
                    android:background="@drawable/btn_back_2"
                    android:textColor="#ffffffff"
                    android:layout_weight="1" />

                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/Appeler"
                    android:background="@drawable/btn_back_2"
                    android:id="@+id/App"
                    android:textColor="#ffffffff"
                    android:layout_weight="1" />

                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/surCarte"
                    android:textColor="#ffffffff"
                    android:background="@drawable/btn_back_2"
                    android:id="@+id/Car"
                    android:layout_weight="1" />

            </LinearLayout>
        </LinearLayout>

</RelativeLayout>

После этого перейдите к своей деятельности и добавьте это:

public void afficherDialogue(){
    dialog3 = new Dialog(MainActivity.context);
    dialog3.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog3.setContentView(R.layout.custom_dialog);
    Cursor medecin = MainActivity.db.lireMedecin(); 
        ((TextView) dialog3.findViewById(R.id.num_tel)).setText("phone number");
            ((TextView) dialog3.findViewById(R.id.nom)).setText("name");
            ((TextView) dialog3.findViewById(R.id.prenom)).setText("last name");
            ((TextView) dialog3.findViewById(R.id.adresse)).setText("addresse");
    Button ok = (Button) dialog3.findViewById(R.id.OK);
    Button App = (Button) dialog3.findViewById(R.id.App);
    Button Car = (Button) dialog3.findViewById(R.id.Car);
    ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog3.dismiss();

        }
    });
    App.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //do something
            dialog3.dismiss();
        }
    });

    Car.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
          //do something
            dialog3.dismiss();
        }
    });

    dialog3.show();

}

Вот как выглядит мой диалог скриншот диалога

1
Charaf Eddine Mechalikh 20 Апр 2015 в 04:21
Спасибо, если я попробую это, он скажет, что мне нужен API 13 для использования «android: TextAppearance.Holo.DialogWindowTitle». Есть ли способ сделать это с помощью API 11?
 – 
progNewbie
20 Апр 2015 в 03:41
Я обновлю свой пост, если найду что-нибудь об API 11
 – 
Charaf Eddine Mechalikh
20 Апр 2015 в 03:51
Это помогает? -> «Android: TextAppearance.DeviceDefault.DialogWindowTitle»
 – 
Charaf Eddine Mechalikh
20 Апр 2015 в 03:53
Нет, для этого требуется уровень API 14. Но я также установил свой minSDK = 13, но заголовок по-прежнему остается синим.
 – 
progNewbie
20 Апр 2015 в 04:02
У меня есть что-то, что может помочь... посмотрите фотографии, размещенные здесь... это называется holoEveryWhere... stackoverflow.com/questions/15623965/…
 – 
Charaf Eddine Mechalikh
20 Апр 2015 в 04:05

Просто позвоните setTitleColor(int textColor); Кратко и точно.

0
SilentKnight 20 Апр 2015 в 04:53
Где мне установить шляпу?
 – 
progNewbie
20 Апр 2015 в 21:06
Везде и в любое время, на самом деле, конечно, в потоке пользовательского интерфейса. Но для вас рекомендуется onCreate или onResume.
 – 
SilentKnight
21 Апр 2015 в 04:39