第二節還有這個XML其定義我的對話:Android的對話框佈局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView android:text="test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
,這是我的對話框:
OverlayItem item = mapOverlays.get(index);
Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.map_menu);
dialog.setCanceledOnTouchOutside(true);
dialog.show();
出於某種原因,我的對話是更大然後我的「測試」的TextView(多更高)。我希望我的對話正如我的文本一樣。我怎樣才能做到這一點 ?
我沒有在我面前的API,但我認爲你需要設置對話框的寬度和高度: – user282172 2012-04-13 12:45:52