smxl.net
当前位置:首页 >> AnDroiD 如何获取AlErtDiAlog的宽高 >>

AnDroiD 如何获取AlErtDiAlog的宽高

WindowManager wm = getWindowManager(); Display display = wm.getDefaultDisplay(); android.view.WindowManager.LayoutParams lp = dialog.getWindow().getAttributes(); lp.width = display.getWidth(); lp.height =LayoutParams.WRAP_CONTE...

WindowManager wm = getWindowManager(); Display display = wm.getDefaultDisplay(); android.view.WindowManager.LayoutParams lp = dialog.getWindow().getAttributes(); lp.width = display.getWidth(); lp.height =LayoutParams.WRAP_CONTE...

AlertDialog dialog = builder.create(); dialog.setView(view); dialog.show(); WindowManager m = getWindowManager(); Display d = m.getDefaultDisplay(); //为获取屏幕宽、高 android.view.WindowManager.LayoutParams p = dialog.getWindo...

1 如果只按你的要求来使用dip, 可以在配置文件中使用dimens.xml 在里边配置数值 如 10dp 然后代码中读取 String string = getString(R.dimen.activity_horizontal_margin); 2 适配不是这么简单的,参考下 http://www.eoeandroid.com/thread-193...

LayoutInflater inflater = getLayoutInflater(); final View layout = inflater.inflate(R.layout.config, (ViewGroup) findViewById(R.id.tableView)); new AlertDialog.Builder(v.getContext()).setTitle("设置选项").setView(layout) .setPo...

方案: 通过设置Dialog的样式实现 步骤: 1、添加style true true 2、代码里面设置dialog的样式Dialog dialog = new Dialog(this,R.style.Dialog_FS); //设置全屏样式dialog.setContentView(R.layout.main); //设置dialog的布局dialog.show();//...

建议你使用自定义xml布局,然后对这个对话框使用setView()方法。具体步骤如下: 1、编写布局文件,比如说叫dialog_layout 2、布局文件转换为View组件 LayoutInflater factory = LayoutInflater.from(你的Activity); View myView = factory.infla...

AlertDialog dialog = builder.create(); dialog.setView(view); dialog.show(); WindowManager m = getWindowManager(); Display d = m.getDefaultDisplay(); //为获取屏幕宽、高 android.view.WindowManager.LayoutParams p = dialog.getWindo...

1. 如果您是直接从资源值转换: int width = getResources().getDimensionPixelSize(R.dimen.popup_width); int height = getResources().getDimensionPixelSize(R.dimen.popup_height); getDialog().getWindow().setLayout(width, height); 然...

这样可以啊,是下面这个效果吗? 代码 public void onDialog(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(android.R.drawable.ic_dialog_info); builder.setTitle("title"); builder.setMessage("...

网站首页 | 网站地图
All rights reserved Powered by www.smxl.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com