C Activity实在声明文件中声明为android:theme="@style/FunctionDialog" ,不知道设置什么属性可以让C Activity不居中而局右

解决方案 »

  1.   

    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;
    }
    }
      

  2.   

    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启动的,没办法用你那个方法啊?
      

  3.   

    那就更省事儿了
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().getAttributes().width = LayoutParams.WRAP_CONTENT;
    getWindow().getAttributes().gravity = Gravity.RIGHT;
    }