我以编程方式创建了一个复选框,显示效果很好。有没有减少复选框宽度和高度的选项?
答案 0 :(得分:-1)
尝试以下::
CheckBox chkBox = new CheckBox(this);
chkBox.setId(++myid);
// AS FOLLOWING, YOU SET SIZE
RelativeLayout.LayoutParams chkBoxParams = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// OR int width, int hieght);
chkBox.setLayoutParams(chkBoxParams);
chkBox.setGravity(Gravity.CENTER);
chkBox.setTextColor(Color.BLACK);
//chkBox.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
chkBox.setText("Scroll Test");
Your_Main_View_Holder_Layout.addView(chkBox);