everybody! Forgive, I badly know English...
I have one problem. My AlertDialog have double background. Look:
http://screenshotuploader.com/s/1406rn7lr
The external background - was made by me. Internal background - I don't know as it to clean. I have two options:
- to clean an internal background
- or to clean an external background, but then to change the internal
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.AppTheme));
//AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.test_dialog, null);
builder.setView(view);
Dialog dialog = builder.create();
dialog.getWindow().setBackgroundDrawableResource(R.drawable.alert_dialog_full_dark);
return dialog;
}
This code builds dialod This XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text in Dialog"
style="@style/big_text" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="edit"
style="@style/EditTextStyle" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_gravity="center_horizontal"
style="@style/ButtonStyle" />
</LinearLayout>
Help me, please. Thanks!
Yes!!! I found the answer! Change background of ProgressDialog
Style for API9 (maybe API8... I'm don't know):
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:alertDialogStyle">@style/CustomAlertDialogStyle</item>
</style>
<style name="CustomAlertDialogStyle" parent="@android:style/Theme.Dialog">
<item name="android:fullDark">@drawable/alert_dialog_full_dark</item>
<item name="android:fullBright">@drawable/alert_dialog_full_dark</item>
<item name="android:topDark">@drawable/alert_dialog_top_dark</item>
<item name="android:topBright">@drawable/alert_dialog_top_dark</item>
<item name="android:centerDark">@drawable/alert_dialog_center_dark</item>
<item name="android:centerBright">@drawable/alert_dialog_center_dark</item>
<item name="android:centerMedium">@drawable/alert_dialog_center_dark</item>
<item name="android:bottomDark">@drawable/alert_dialog_bottom_dark</item>
<item name="android:bottomBright">@drawable/alert_dialog_bottom_dark</item>
<item name="android:bottomMedium">@drawable/alert_dialog_bottom_dark</item>
</style>
Style for API11 and more:
<style name="AppTheme" parent="@style/Theme.AppCompat">
<item name="android:alertDialogTheme">@style/AppTheme.AlertDialogTheme11</item>
</style>
<style name="AppTheme.AlertDialogTheme11" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@null</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:background">@color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowCloseOnTouchOutside">true</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowMinWidthMajor">@dimen/dialog_min_width_major</item>
<item name="android:windowMinWidthMinor">@dimen/dialog_min_width_minor</item>
<item name="android:alertDialogStyle">@style/AppTheme.AlertDialogTheme11.AlertDialogStyle11</item>
</style>
<style name="AppTheme.AlertDialogTheme11.AlertDialogStyle11">
<item name="android:fullDark">@drawable/alert_dialog_full_dark</item>
<item name="android:fullBright">@drawable/alert_dialog_full_dark</item>
<item name="android:topDark">@drawable/alert_dialog_top_dark</item>
<item name="android:topBright">@drawable/alert_dialog_top_dark</item>
<item name="android:centerDark">@drawable/alert_dialog_center_dark</item>
<item name="android:centerBright">@drawable/alert_dialog_center_dark</item>
<item name="android:centerMedium">@drawable/alert_dialog_center_dark</item>
<item name="android:bottomDark">@drawable/alert_dialog_bottom_dark</item>
<item name="android:bottomBright">@drawable/alert_dialog_bottom_dark</item>
<item name="android:bottomMedium">@drawable/alert_dialog_bottom_dark</item>
</style>
It was necessary to find style of the bottom bar (button) and color of points of the list in dialogue