我在Eclipse中创建了一个新的应用程序,目标是Jelly Bean。这是所有自动创建的代码。清单设置应用程序主题AppName的:Android对话主题使图标太亮
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
. . .
翻译为AppBaseTheme在值DIR风格:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
和值-V14/styles.xml是:
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
然后在退出之前创建了一个确认对话框:
case R.id.menu_quit:
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.confirm_title)
.setMessage(R.string.confirm_text)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
而出现的对话框:
为什么ic_dialog_icon这么轻?它几乎看不见。我正在使用所有的默认设置,我没有修改主题或任何颜色,系统不应该选择与背景对比更强的图标吗?我该如何解决它?
编辑与修复
继Tomik信息,我读android.R.attr.alertDialogIcon文档和(与setIconAttribute()取代setIcon()来)
new AlertDialog.Builder(this)
.setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.confirm_title)
.setMessage(R.string.confirm_text)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
做出此修复程序
现在对话框如下所示:
按照您的评论我读的信息和修复代码。我将很快更新问题以反映结果。 :::顺便说一句,我并不担心图标看起来总是一样的,只是它们是可见的。 – ilomambo 2013-02-16 14:10:35
信息对话框怎么样? 是否有类似的 '.setIconAttribute(android.R.attr。????)' 到位 '.setIcon(android.R.drawable.ic_dialog_info)的使用' – JFar 2016-03-24 23:00:54