开发者

adding a layout to another layout

开发者 https://www.devze.com 2023-02-20 01:11 出处:网络
sir a need t开发者_如何学Pythono add a layout to another layout on click of a button. Is it possible how.Example here:

sir a need t开发者_如何学Pythono add a layout to another layout on click of a button.

Is it possible how.


Example here: How to lay out Views in RelativeLayout programmatically?


It is. Add this code to the onClickListener of your button:

LinearLayout layout = new LinearLayout(...);

// init this layout here

RelativeLayout parentLayout = (RelativeLayout) findViewById(R.id.myLayout);
parentLayout.addView(layout);
0

精彩评论

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