addrule android用法,的Android addrule(RelativeLayout.BELOW)不正确地呈现

public void onCheckboxClicked(View view) {

CheckBox checkBox = (CheckBox) view;

RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

params.addRule(RelativeLayout.BELOW, checkBox.getId());

LinearLayout li = (LinearLayout) findViewById(R.id.checkbox_layout);

EditText ed = new EditText(RegisterActivity.this);

ed.setLayoutParams(params);

li.addView(ed);

}

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

>

android:id="@+id/checkbox_layout"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical">

android:id="@+id/hsc"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:onClick="onCheckboxClicked"

android:text="HSC"

android:textSize="15sp" />

android:id="@+id/ielts"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginTop="15dp"

android:onClick="onCheckboxClicked"

android:text="IELTS"

android:textSize="15sp" />

android:id="@+id/toefl"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginTop="15dp"

android:onClick="onCheckboxClicked"

android:text="TOEFL"

android:textSize="15sp" />

这是我的XML布局文件

我只想补充Edittext正好在“checked”复选框的下面,但是当我运行这段代码时,edittext被添加到了Linearlayout的底部...

如何在复选框下方添加?

+0

哦,酷我知道它的任何解决方案或解决方法? –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值