当我尝试动态显示复选框时,每个都与其他重叠。我尝试的代码是
while(pCur.moveToNext()){
String phoneNo=pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
RelativeLayout rl=(RelativeLayout)findViewById(R.id.r1);
ScrollView scroll = new ScrollView(MainActivity.this);
CheckBox c1 = new CheckBox (MainActivity.this);
c1.setText(name);
c1.setBackgroundColor( -16776961);
LayoutParams lp=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
lp.bottomMargin=10;
LayoutParams lp1=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
c1.setLayoutParams(lp);
scroll.addView(c1);
scroll.setLayoutParams(lp1);
rl.addView(scroll);
}
如何在下一行显示每个复选框?