我正在使用单选警报对话框,在其中我想将默认的蓝色(标题行和单选按钮)替换为我在标题栏中使用的橙色。我已经成功使用
setCustomTitle()
更改了标题栏,但是我无法摆脱这个可恶的蓝色。
对于标题栏:
<?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:background="@color/orange" >
<TextView
android:id="@+id/alertTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="14dp"
android:gravity="center"
android:text="Alert Title"
android:textColor="@color/white"
android:textSize="18sp" />
</LinearLayout>
构建AlertDialog
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
View customTitle = View.inflate(MainActivity.this, R.layout.custom_alert_title, null);
builder.setCustomTitle(customTitle);
builder.setSingleChoiceItems(mAlertOptions, -1, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// do stuff
dialog.dismiss();
}
}).create().show();
这是它的外观
我需要去掉这个蓝色!帮帮我!