相対レイアウトのように、実行時にフィールドを作成するように取り組んでいます。たとえば、右隅に1つのテキストフィールドを追加し、左隅に1つのチェックボックスを追加しています。これが問題になっているため、現在私は次のコードを使用しています:
ViewGroup hori_layout=new RelativeLayout(getParent());
hori_layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
TextView tv1=new TextView(getParent());
tv1.setText(_medContactNames[i]);
tv1.setTextColor(Color.BLACK);
CheckBox cb = new CheckBox(getApplicationContext());
hori_layout.addView(tv1);
hori_layout.addView(cb);
layout.addView(hori_layout);