How can I decrease the radio button size in android using j开发者_运维百科ava code? Its too big.
I'm using the code:
deal = new RadioButton(context);
deal.setHeight(10);
deal.setWidth(5);
which is not effective at all. Please suggest.
Are you creating radio button dynamically. Then instead of setting height and width using setheight
and setwidth
method you can use layoutparams
. Set the width and height in layout params
...given below is the example of setting parameters of the button..
addQuestion = new Button(NewEmirContext);
addQuestion.setId(134);
addQuestion.setTag("addQuestion");
addQuestion.setBackgroundDrawable(getResources().getDrawable(R.drawable.add_button));
addQuestion.setGravity(Gravity.LEFT);
LinearLayout.LayoutParams addQuestion_Params =
new LinearLayout.LayoutParams(24, 24);
addQuestion_Params.leftMargin=20;
addQuestion.setOnClickListener(mirScreenClickListener);
questionAndAddButtonContainer.addView(addQuestion, addQuestion_Params);
精彩评论