Chcę zmienić tło okna dialogowego Alert. Próbowałem następujący fragment kodu, aby to zrobić:Jak zmienić tło okna alertu systemu Android Tytuł
<style name="Theme.AlertDialog" parent="@android:style/Theme.Holo.Light.Dialog">
<item name="android:background">@android:color/transparent</item>
<item name="android:textColor">#659F26</item>
<item name="android:windowTitleStyle">@style/Theme.AlertDialog.Title</item>
</style>
<style name="Theme.AlertDialog.Title" parent="@android:style/TextAppearance.DialogWindowTitle">
<item name="android:background">@drawable/cab_background_top_example</item>
</style>
kod Java:
ContextThemeWrapper ctw = new ContextThemeWrapper(this, R.style.Theme_AlertDialog);
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ctw);
alertDialogBuilder.setTitle(getResources().getString(R.string.confirmation));
alertDialogBuilder.setMessage(getResources().getString(R.string.msg));
alertDialogBuilder.show();
Moja aplikacja wyświetla okno dialogowe jak poniżej:
gdy chcę go szukać na przykład:
Proszę zasugerować, co robię źle.
dlaczego głosowanie w dół? – mudit
Po prostu rozwiązuję mój problem z twojego pytania, więc +1 z mojej strony ..... – duggu