当我设置布局参数时,文本复选框变为不可见。我想这可见。 谢谢Y
LayoutParams lparams = new LayoutParams(30, 60);
LinearLayout layoutCb = new LinearLayout(this);
CheckBox checkbox = new CheckBox(this);
checkbox.setHeight(30);
checkbox.setGravity(Gravity.CENTER);
int cbnum = coluna+1;
checkbox.setTag("CbCargaNotasL"+cbnum);
checkbox.setWidth(37);
checkbox.setButtonDrawable(R.drawable.checkbox);
layoutCb.setGravity(Gravity.RIGHT);
layoutCb.setLayoutParams(lparams);
layoutCb.addView(checkbox);
layoutCb.setBackgroundResource(R.drawable.border);
LinhaTabela.setGravity(Gravity.RIGHT);
LinhaTabela.addView(layoutCb);
答案 0 :(得分:0)
用这个改变你的LayourParams ..
LinearLayout.LayoutParams btnParams = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
检查这是否有帮助。