'Theme.Holo.Light.Dialog'에서 상속 한 사용자 정의 테마를 작성했습니다.Android - 사용자 정의 대화 상자에 대한 사용자 정의 테마 지정 AlertDialog.Builder가 대화 상자에 내용을 래핑합니다.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="cust_dialog" parent="@android:style/Theme.Holo.Light.Dialog">
</style>
</resources>
는 내 코드 :
private AlertDialog testDialog;
AlertDialog.Builder testBuilder;
LayoutInflater inflater = (LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.test_dialog,
(ViewGroup) findViewById(R.id.test_root));
testBuilder = new AlertDialog.Builder(this, R.style.cust_dialog);
testBuilder.setView(layout);
testBuilder.setTitle("Support");
testDialog = testBuilder.create();
testDialog.show();
이 대화 이내 내 대화가 발생합니다. 이 문제를 어떻게 해결할 수 있습니까?
감사합니다.
편집 ::::
이 내 test_dialog.xml 레이아웃입니다 :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/test_root"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/test1"
android:layout_width="300dp"
android:layout_height="75dp"
android:text="@string/test"
android:gravity="center" />
<Button
android:id="@+id/test2"
android:layout_width="300dp"
android:layout_height="75dp"
android:text="@string/test"
android:layout_below="@id/test1"
android:gravity="center" />
</RelativeLayout>
아마도'R.layout.test_dialog'에는 그 이상의 내용이 포함되어 있을까요? 'setView()': "사용자 정의보기를 대화 상자의 내용으로 설정". 거기에 전체 대화 상자 레이아웃을 추가하면 대화 상자 안에 대화 상자가 생깁니다. – zapl
내 test_dialog 레이아웃 xml을 추가했습니다. 나는 거기에 버튼이 두 개 밖에 없다. – CLDev
팽창 중에 지정한 루트 요소로 인해 야합니다. 그냥'View layout = inflater.inflate (R.layout.test_dialog, null);와 같이 해보십시오. 그렇지 않으면 레이아웃 자체를 팽창시킵니다. – zapl