LinearLayout
プログラムで幅が等しい
2つを作成しようとしています:
mGroupLayout.setOrientation(HORIZONTAL);
mGroupLayout.setWeightSum(2f);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
0,
LinearLayout.LayoutParams.WRAP_CONTENT
);
params.weight = 1.0f;
leftLayout = new LinearLayout(getContext());
leftLayout.setOrientation(VERTICAL);
leftLayout.setLayoutParams(params);
mGroupLayout.addView(
leftLayout,
params
);
rightLayout = new LinearLayout(getContext());
rightLayout.setOrientation(VERTICAL);
rightLayout.setLayoutParams(params);
mGroupLayout.addView(
rightLayout,
params
);
しかし、すべての線形レイアウトが表示されません (幅が 0 です)。どうすればそれができますか?