Avtivity以dialog形式弹出后怎么不居中而是靠右? C Activity实在声明文件中声明为android:theme="@style/FunctionDialog" ,不知道设置什么属性可以让C Activity不居中而局右 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Dialog dialog = getDialog(); Window window = dialog == null ? null : dialog.getWindow(); if (dialog != null && window != null) { LayoutParams attr = window.getAttributes(); if (attr != null) { attr.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; attr.gravity = Gravity.RIGHT; } } fanhui.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent function = new Intent(); function.setClass(UserJiuGongGeActivity.this, FunctionActivity.class); startActivity(function); } });dialog是Activity,是由intent启动的,没办法用你那个方法啊? 那就更省事儿了 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().getAttributes().width = LayoutParams.WRAP_CONTENT; getWindow().getAttributes().gravity = Gravity.RIGHT; } 新手请教一个错误问题!感谢! 我有一个需求,想了很久,没有想到解决的方案,希望有高手指点迷津,详述如下 为什么Google的位置定位接口现在无法访问??急 大家见过这种异常吗?100分紧急求助! android 怎么得到最近使用过的程序? 数据库查询老是报空指针,求高人 onChange里能不能写发短息的代码? 求助,伪装来电或来短信的功能是怎么实现的? 从资源文件释放数据库的一个奇怪现象 捕获全局异常,出现崩溃不关闭程序,然后怎么跳到指定界面 怎么获取到通过intent跳转到本页面的上一个Activity proguard混淆
Window window = dialog == null ? null : dialog.getWindow();
if (dialog != null && window != null) {
LayoutParams attr = window.getAttributes();
if (attr != null) {
attr.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
attr.gravity = Gravity.RIGHT;
}
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent function = new Intent();
function.setClass(UserJiuGongGeActivity.this, FunctionActivity.class);
startActivity(function);
}
});dialog是Activity,是由intent启动的,没办法用你那个方法啊?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().getAttributes().width = LayoutParams.WRAP_CONTENT;
getWindow().getAttributes().gravity = Gravity.RIGHT;
}