1

I created a check box programmatically and it shows well. Is there any option to reduce check box width and height?

Nikola K.
  • 7,093
  • 13
  • 31
  • 39
shivcena
  • 2,023
  • 8
  • 24
  • 50

1 Answers1

-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