Интересно, как я могу изменить этот цвет (синий банкомат «Установить номер телефона от партнера») на оранжевый, как показано ниже в поле ввода: цвет: #FF9900
Кто-нибудь знает как это сделать?
Изменить:
Я определил свой стиль следующим образом:
<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>
Но это не работает. Есть идеи?
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();
}
Вот как выглядит мой диалог
Просто позвоните setTitleColor(int textColor)
; Кратко и точно.
onCreate
или onResume
.
Похожие вопросы
Связанные вопросы
Новые вопросы
android
Android — это мобильная операционная система Google, используемая для программирования или разработки цифровых устройств (смартфонов, планшетов, автомобилей, телевизоров, одежды, очков, IoT). Для тем, связанных с Android, используйте теги, специфичные для Android, такие как android-intent, android-activity, android-adapter и т. д. Для вопросов, отличных от разработки или программирования, но связанных с Android framework, используйте эту ссылку: https://android .stackexchange.com.