`

动态设置View的高度

 
阅读更多
        int newHeight = 200;
        //注意这里,到底是用ViewGroup还是用LinearLayout或者是FrameLayout,主要是看你这个EditTex
        //控件所在的父控件是啥布局,如果是LinearLayout,那么这里就要改成LinearLayout.LayoutParams
        ViewGroup.LayoutParams lp = editText.getLayoutParams();
        lp.height = newHeight;
        lp.addRule(RelativeLayout.ALIGN_LEFT, R.id.capture_crop_layout);
        editText.setLayoutParams(lp);
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics