我試圖改變AlertDialog.Builder的按鈕顏色,但我沒有找到辦法做到這一點。更改AlertDialog.Builder按鈕顏色
我想要改變按鈕的顏色和標題爲白色,就像在HOLO主題。
看到這些2個截圖例子:
伊夫看着這裏:
How to change theme for AlertDialog
Change the style of AlertDialog
How to change the background of the custom alert dialog
所有這些都沒有爲我工作。
這裏是我的代碼:
public void logInDialog()
{
ContextThemeWrapper ctw = new ContextThemeWrapper(this, R.style.dialogStyle);
AlertDialog.Builder builder = new AlertDialog.Builder(ctw);
builder.setTitle("Log in");
View prefView = View.inflate(this, R.layout.log_in, null);
//The rest of the code.........
}
這是我的風格代碼:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="dialogStyle" parent="android:Theme.Dialog">
<item name="android:background">@color/white</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:button">@color/white</item>
</style>
</resources>
大,由於一噸! – Malfunction