AlertDialog对话框大小设置 我想要让对话框的宽度只有imagebutton的宽度那么大,然后对话框显示的时候在最右边 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼主,这玩意你得先show()出dialog, 再来设置属性。private void show_menu_dlg() { //加载对话框资源界面 LayoutInflater factory = LayoutInflater.from(this.getContext()); final View dlgview = factory.inflate(R.layout.player_menu, null); AlertDialog.Builder dlg_login = new AlertDialog.Builder(this.getContext()); //将对话框布局设置到视图 dlg_login.setView(dlgview); //创建 并显示对话框 AlertDialog dlg = dlg_login.create(); dlg.show(); //设置对话框位置 LayoutParams lp = dlg.getWindow().getAttributes(); //dlg.getWindow().setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); lp.x = m_screen_width - 64; lp.width = 64; dlg.getWindow().setAttributes(lp); dlg.setCanceledOnTouchOutside(true); } android查询数据库查询不到数据,不知道为什么 AsyncTask 如何更新数据到ListView上面 如何实现移动办公? android launcher和视频组件bug htc g6 能装ANDRIOD 2.3吗? 关于图片存储问题 为什么HttpURLConnection连接jsp文件在eclipse成功,在MyEclipse失败 android 中 怎么用java 调用 so 库 http 返回的数据解析后 汉字格式不对"\u516c\u53f8\u5927\u4f1a" 安卓图片截取返回模糊 记录我的【左手圣经】开发过程 Android 开发在程序退出时的操作应该放在哪处理
private void show_menu_dlg()
{
//加载对话框资源界面
LayoutInflater factory = LayoutInflater.from(this.getContext());
final View dlgview = factory.inflate(R.layout.player_menu, null);
AlertDialog.Builder dlg_login = new AlertDialog.Builder(this.getContext());
//将对话框布局设置到视图
dlg_login.setView(dlgview);
//创建 并显示对话框
AlertDialog dlg = dlg_login.create();
dlg.show();
//设置对话框位置
LayoutParams lp = dlg.getWindow().getAttributes();
//dlg.getWindow().setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
lp.x = m_screen_width - 64;
lp.width = 64;
dlg.getWindow().setAttributes(lp);
dlg.setCanceledOnTouchOutside(true);
}