ImageView的在自定义对话框 - FILL_PARENT不工作,我的对话框中小 [英] ImageView in a Custom Dialog - fill_parent does not work and my dialog is small
本文介绍了ImageView的在自定义对话框 - FILL_PARENT不工作,我的对话框中小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的要求:我必须把一些照片(一些小的分辨率,一些大的分辨率)在一个对话框并显示全屏
I have a simple request: I have to put some pictures (some small resolution, some big resolution) in a dialog and display them fullscreen.
我试过这样:
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无处不在,不应该对话框拿全屏?
As I wrote fill_parent everywhere, shouldn't the dialog take the full screen?
推荐答案
试一下:
dialog.getWindow().getAttributes().width = LayoutParams.FILL_PARENT;
希望它帮助。
这篇关于ImageView的在自定义对话框 - FILL_PARENT不工作,我的对话框中小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文