¿Cómo reducir el tamaño de la casilla de verificación en android?

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

preguntado el 31 de julio de 12 a las 12:07

i create the check box programmatically -

1 Respuestas

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);

Respondido 31 Jul 12, 12:07

: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

What do you mean by decrease in level?? - Chintan Raghwani

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

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.