I created a check box programmatically and it shows well. Is there any option to reduce check box width and height?
Asked
Active
Viewed 1,535 times
1 Answers
-1
Try following ::
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);

Chintan Raghwani
- 3,370
- 4
- 22
- 33
-
:your code for layoutparams just fix the size only,give the value of 20 in chkBoxParams then test it, but wat i want is the box size should decrease in set level – shivcena Jul 31 '12 at 11:47
-
-
if i give the value 20 my check box size should reduce,, if i give 10 my check box size should reduce half size of 20 – shivcena Jul 31 '12 at 12:05