SORU
19 EKİM 2014, Pazar


Değil şekillendirme uyarı Materyal Tasarımı diyaloglar

Benim app için appCompat malzeme tasarım ekledim ve uyarı diyaloglar benim birincil, primaryDark, ya da vurgu rengi kullanarak değil gibi görünüyor.

Burada temel benim tarzım:

<style name="MaterialNavyTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/apptheme_color</item>
    <item name="colorPrimaryDark">@color/apptheme_color_dark</item>
    <item name="colorAccent">@color/apptheme_color</item>
    <item name="android:textColorPrimary">@color/action_bar_gray</item>
</style>

Benim anlayışıma göre diyaloglar düğme metni de bu renkleri kullanmak gerekir. Benim anlayış yanlış mıyım yoksa daha yapmam gereken var mı?


Çözüm:

İşaretlenen cevap doğru yolda beni yakaladı.

<style name="MaterialNavyTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/apptheme_color</item>
    <item name="colorPrimaryDark">@color/apptheme_color_dark</item>
    <item name="colorAccent">@color/apptheme_color</item>
    <item name="android:actionModeBackground">@color/apptheme_color_dark</item>
    <item name="android:textColorPrimary">@color/action_bar_gray</item>
    <item name="sdlDialogStyle">@style/DialogStyleLight</item>
    <item name="android:seekBarStyle">@style/SeekBarNavyTheme</item>
</style>

<style name="StyledDialog" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorPrimary">@color/apptheme_color</item>
    <item name="colorPrimaryDark">@color/apptheme_color_dark</item>
    <item name="colorAccent">@color/apptheme_color</item>
</style>

CEVAP
22 NİSAN 2015, ÇARŞAMBA


AppCompat v22.1 yeni yeni android.support.v7.app.AlertDialog kullanabilirsiniz.

Sadece bu gibi bir kod:

import android.support.v7.app.AlertDialog

AlertDialog.Builder builder =
       new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle);
            builder.setTitle("Dialog");
            builder.setMessage("Lorem ipsum dolor ....");
            builder.setPositiveButton("OK", null);
            builder.setNegativeButton("Cancel", null);
            builder.show();

Ve bu gibi bir stil kullanın:

<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
        <item name="colorAccent">#FFCC00</item>
        <item name="android:textColorPrimary">#FFFFFF</item>
        <item name="android:background">#5fa3d0</item>
    </style>

Aksi halde geçerli tema olarak tanımlayabilirsiniz:

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <!-- your style -->
    <item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
</style>

ve kodu:

 import android.support.v7.app.AlertDialog

    AlertDialog.Builder builder =
           new AlertDialog.Builder(this);

Kitkat üzerinde AlertDialog burada: enter image description here

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Noam Erez

    Noam Erez

    3 NİSAN 2012
  • thewinekone

    thewinekone

    17 Aralık 2005
  • Tianna Sierra Dance

    Tianna Sierr

    16 EYLÜL 2013