开发者

Setting properties of Button

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜