TextView tv = new TextView(context);
LinearLayout ll = new LinearLayout(context);
LayoutParams params = new LayoutParams(0,LayoutParams.WRAP_CONTENT ,100.0f);
ll.addView(tv ,params);
100.0f代表weight为100
本文介绍如何在Android中使用LinearLayout布局管理器设置子视图的权重属性(weight),通过具体代码示例展示如何设置TextView的权重为100。
2384
3159

被折叠的 条评论
为什么被折叠?