我有一个简单的请求:我需要在对话框中放置一些图片(一些小分辨率,一些大分辨率),并将它们全屏显示。
我尝试了这个:
Dialog dialog = new Dialog(getActivity());
dialog.setContentView(R.layout.custom_dialog);
int picId = Integer.valueOf(webcamCursor.getString(webcamCursor
.getColumnIndex("_id")));
dialog.setTitle(webcamCursor.getString(webcamCursor
.getColumnIndex("City")));
image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.icon);
new DownloadPicTask().execute(Snippets.getUrlFromCat(picId, cat));
dialog.show();
我的布局是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
>
<ImageView android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
/>
</LinearLayout>
既然我已经在各处写了fill_parent,那么对话框不应该占据整个屏幕吗?