사용자 지정 대화 상자를 만들려고하는데 내용이 가운데에 놓여 있지만 항상 왼쪽 맞춤으로 끝납니다. 여기 aboutdialog.xml입니다 :Android Dialog의 레이아웃을 가운데에 배치하는 방법은 무엇입니까?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:a="http://schemas.android.com/apk/res/android"
a:orientation="vertical"
a:id="@+id/AboutDialogLayout"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:layout_gravity="center_horizontal"
a:gravity="center_horizontal">
<ImageView a:id="@+id/imageView1"
a:src="@drawable/pricebook"
a:layout_height="wrap_content"
a:layout_width="wrap_content"/>
<TextView a:layout_height="wrap_content"
a:textAppearance="?android:attr/textAppearanceLarge"
a:id="@+id/textView1"
a:text="Price Book"
a:layout_width="wrap_content"/>
<TextView a:layout_height="wrap_content"
a:id="@+id/textView2"
a:layout_width="wrap_content"
a:text="foo"/>
</LinearLayout>
그리고 내 (관련) 코드 :
Dialog d = new Dialog(this);
d.setContentView(R.layout.aboutdialog);
d.setTitle(R.string.app_name);
내가 무슨 말이냐? 도움을 주셔서 감사합니다.
이미지 :
이상한 일입니다. 그것은 나를 위해 잘 작동합니다. 스크린 샷을 게시 할 수 있습니까? – inazaruk
+1을 사용하는 경우 : android : everywhere 대신에 어떻게 했습니까? –
네, 저도 잘 작동하는지 확인합니다. –