我想知道是否有人可以帮助我.我正在尝试创建自定义AlertDialog.为此,我在styles.xml中添加了以下代码行
<resources>
<style name="CustomAlertDialog" parent="android:Theme.Dialog.Alert">
<item name="android:windowBackground">@drawable/color_panel_background</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
以下是主要活动.
package com.customdialog;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
public class CustomDialog extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.setTheme(R.style.CustomAlertDialog);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("HELLO!");
builder .setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//MyActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int …Run Code Online (Sandbox Code Playgroud) 我试图通过样式扩大我的所有应用程序对话框按钮上的文本大小.以下代码将更改按钮背景颜色甚至文本大小写,但由于某种原因,textSize项目不符合:
<style name="MyAppTheme" parent="@android:style/Theme.Holo">
<item name="android:dialogTheme">@style/MyApp.Dialog</item>
<item name="android:alertDialogTheme">@style/MyApp.Dialog.Alert</item>
</style>
<style name="MyApp.Dialog" parent="@android:style/Theme.Holo.Dialog">
<item name="android:borderlessButtonStyle">@style/MyApp.BorderlessButton</item>
</style>
<style name="MyApp.Dialog.Alert" parent="@style/MyApp.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
</style>
<style name="MyApp.BorderlessButton" parent="@android:style/Widget.Holo.Button.Borderless">
<item name="android:textSize">50sp</item>
<item name="android:textAllCaps">true</item>
<item name="android:background">#800</item>
</style>
Run Code Online (Sandbox Code Playgroud)

为什么没有读取textSize?我需要做些什么来扩大它?
android android-layout android-theme android-dialog android-styles
是否可以减少AlertDialog.Builder标题字体大小和正按钮大小?如果有,请让我该怎么办?