📌  相关文章
📜  以编程方式将视图添加到 relativelayout - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:43.350000             🧑  作者: Mango

代码示例1
TextView tv = new TextView(mContext);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
    ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
params.leftMargin = 107
...
mRelativeLayout.addView(tv, params);