开发者

Setting properties of Button

开发者 https://www.devze.com 2023-03-14 14:38 出处:网络
How to set Button\"Layout below\"properties by code in android inside an Relativelayout i have defined relative layout by using findview开发者_运维问答by id.use addRule() of LayoutParams to set layout

How to set Button "Layout below" properties by code in android inside an Relativelayout i have defined relative layout by using findview开发者_运维问答by id.


use addRule() of LayoutParams to set layout below

RelativeLayout.LayoutParams lineParams = new RelativeLayout.LayoutParams(
                android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT,
                android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);

        lineParams.addRule(RelativeLayout.BELOW, myview.getId());

Add this button to RelativeLayout which is defined

Relativelayout rl= (RelativeLayout) findViewById(R.id.Relativelayout01);
rl.addView(b,lineParams);
0

精彩评论

暂无评论...
验证码 换一张
取 消