0
我想知道如何使用sdk api 10
自定義主題/風格AlertDialog
。我知道該怎麼做,從11日起但不知道如何做到這一點的10自定義alertdialog android api 10
XML版式文件
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
style="@style/dialog_theme" >
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/disclaimerText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/disclaimer"
android:padding="5dp"/>
<CheckBox
android:id="@+id/checkDisclaimer"
style="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="@string/agree" />
</LinearLayout>
</ScrollView>
JAVA資源文件
AlertDialog.Builder builder = new AlertDialog.Builder(this);
//Setting Dialog Title
builder.setTitle("Disclaimer");
//Setting Dialog Message
builder.setMessage(R.string.disclaimer);
View view = (View) LayoutInflater.from(this).inflate(R.layout.layout_disclaimer, null);
builder.setView(view);
我已經創建了自定義佈局,並添加到對話框中,但問題仍然不同,在我的佈局中,我添加了style =「@ style/dialog_theme」但不行,我仍然可以看到系統的佈局。我編輯了我的答案 – JAndroid