我在我的 Android(API 15) 应用程序中添加了一个主题,但它产生了将文本隐藏在我的对话框中的意外后果。
这是没有样式的外观
这是添加样式后的外观
这是我构建对话框的方式:
private void showWarning() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Warning");
builder.setMessage("Information shown might be wrong.");
builder.setCancelable(false);
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialogs.remove(DIALOG_WARNING);
}
});
builder.setNegativeButton("Quit", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
TravelHealthActivity.mInstance.deleteDatabase("TravelHealth");
finish();
}
});
AlertDialog dlg = builder.create();
dlg.setCanceledOnTouchOutside(false);
dialogs.put(DIALOG_WARNING, dlg);
dlg.show();
}
这是我完整的 style.xml,我一直在尝试摆脱微调器下拉菜单的背景,因此有一大堆背景资料。我是样式的新手,所以我不确定什么是相关的,并且可能导致文本消失。
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="appcin" parent="@android:style/Theme.NoTitleBar.Fullscreen">
<item name="android:spinnerStyle">@style/spinnerStyle</item>
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerDropDownItem</item> -->
<item name="android:background">#FFFFFF</item>
<item name="android:textColor">#000000</item>
<item name="android:checkboxStyle">@style/checkboxStyle</item>
<item name="android:popupBackground">@null</item>
<item name="android:dropDownListViewStyle">@style/DropDownStyler</item>
<item name="android:dropDownSpinnerStyle">@style/DropDownStyle</item>
<item name="android:dropDownSelector">@style/DropDownStyle</item>
</style>
<style name="layout">
<item name="android:padding">10dip</item>
</style>
<style name="title" parent="@android:style/TextAppearance">
<item name="android:textColor">#993399</item>
</style>
<style name="text" parent="@android:style/TextAppearance">
<item name="android:textColor">#111111</item>
</style>
<style name="textview" parent="@android:style/TextAppearance">
<item name="android:textColor">#993399</item>
<item name="android:background">#FFFFFF</item>
</style>
<style name="edittext" parent="@android:style/TextAppearance">
<item name="android:textColor">#111111</item>
</style>
<style name="button" parent="@android:style/TextAppearance">
<item name="android:textColor">#111111</item>
<item name="android:background">@drawable/rect_white</item>
<item name="android:padding">10dip</item>
<item name="android:layout_marginLeft">10dip</item>
</style>
<style name="spinnerStyle">
<item name="android:background">@drawable/pink_white_dropdown</item>
<item name="android:popupBackground">@null</item>
<item name="android:clickable">true</item>
</style>
<style name="SpinnerItem">
<item name="android:textColor">#993399</item>
<item name="android:popupBackground">@null</item>
<item name="android:background">@drawable/pink_white_dropdown</item>
<item name="android:maxHeight">10dip</item>
</style>
<style name="SpinnerDropDownItem">
<item name="android:textColor">#993399</item>
<item name="android:popupBackground">@null</item>
<!-- <item name="android:background">#FFFFFF</item> -->
</style>
<style name="DropDownStyle">
<item name="android:background">#FFF000</item>
<item name="android:popupBackground">@null</item>
<item name="android:cacheColorHint">#FFF000</item>
</style>
<style name="checkboxStyle" parent="@android:style/Widget.Holo.Light.CompoundButton.CheckBox">
<item name="android:textColor">#993399</item>
</style>