Mon*_*oya 1 android android-alertdialog android-styles
我刚刚在我的应用程序中更新了库版本,现在AlertDialog
按钮的文本颜色为白色.在此之前,colorAccent
如果我没记错的话,那就是指定它们的属性.我尝试了很多不同的属性,但似乎没有一个属性能够工作.
示例照片 - 在右下方,您可以看到非常隐蔽的按钮:
我当前的警报对话框样式:
<style name="AlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/website_main</item>
<item name="android:textColor">@color/website_main</item>
</style>
Run Code Online (Sandbox Code Playgroud)
以我的主题风格:
<item name="android:alertDialogStyle">@style/AlertDialogStyle</item>
Run Code Online (Sandbox Code Playgroud)
我正在使用的支持/设计/ appcompat的当前版本是: 25.1.0
我在其中创建的Java代码AlertDialog
:
android.support.v7.app.AlertDialog.Builder alertDialogBuilder = new android.support.v7.app.AlertDialog.Builder(activity);
alertDialogBuilder
.setCancelable(false)
.setPositiveButton(activity.getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
<UnrelatedLogic...>
}
});
return alertDialogBuilder.show();
Run Code Online (Sandbox Code Playgroud)
在这里我使用的ListPreference
还使用了AlertDialog
:
android.support.v7.preference.ListPreference lang_preference = (android.support.v7.preference.ListPreference) findPreference("language_chooser");
Run Code Online (Sandbox Code Playgroud)
有什么建议?
小智 5
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/teal</item>
<item name="android:textColorPrimary">@color/bg_3</item>
<item name="android:background">@color/bg_border</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在Activity/Adapter中使用Style
AlertDialog.Builder builder = new AlertDialog.Builder(mContext, R.style.AppCompatAlertDialogStyle);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3551 次 |
最近记录: |