【发布时间】:2010-10-07 19:15:55
【问题描述】:
我无法准确找到我需要用来在相对布局的子视图上设置参数的语法。我有一个根相对布局,我想像这样设置 2 个彼此相邻的子文本视图
---------- --------- |第二 | |第一 | ---------- ---------所以我有
public class RL extends RelativeLayout{
public RL(context){
TextView first = new TextView(this);
TextView second = new TextView(this);
first.setText('First');
first.setId(1);
second.setText('Second');
second.setId(2);
addView(first, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT,
LayoutParams.ALLIGN_PARENT_RIGHT ???);
addView(first, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT,
LayoutParams.ALLIGN_RIGHT_OF(first.getId()) ???);
}
}
如何设置相对对齐方式?
【问题讨论】:
标签: android android-layout android-relativelayout