赞
踩
点击弹出自定义对话框,展示一张网络图片:
- //点击弹出自定义对话框,展示一张网络图片
- public void clickToShowImage(){
- View view = View.inflate(getBaseContext(), R.layout.group_click_image, null);
- //这里的imageview是自定义的,需要引用----------->
- final SmartImageView group_click_image = (SmartImageView)view.findViewById(R.id.group_click_image);
- //对话框展示属性
- final Dialog dialog = new Dialog(PageGosibu3.this,R.style.dialog_show_style);
- dialog.setContentView(view);//布局view
- dialog.setCanceledOnTouchOutside(true);//点击外部和返回键都可以取消对话框
-
- //设置图片、对话框的宽、高都和屏幕一样大
- WindowManager wm = getWindowManager();
- Display display = wm.getDefaultDisplay();
- //必须在线性布局下,设置控件的宽和高
- LinearLayout.LayoutParams params = (android.widget.LinearLayout.LayoutParams) group_click_image.getLayoutParams();
- params.width = display.getWidth();
- params.height = display.getHeight();
- group_click_image.setLayoutParams(params);
- LayoutParams lp = dialog.getWindow().getAttri
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。