vishal gaurav
vishal gaurav

Reputation: 686

how to increase space between radio buttons in radio group in android

I have a header row which is actually some fields header put in horizontal linear layout. Below that row i have five other rows which are either radio buttons or edit boxes which represents values which user will select for each column. Let's say i have three elements in header e.i A, B, C. A has four values i.e PQR,STU,VWX,YZA and B has 3 values i.e CVB,SDF,WER and C is a radio button for boolean value true or false as shown below.

s.n A B C PQR STU VWX YZA CVB SDF WER X 1 O O O O O O O [] 2 O O O O O O O []

The problem is radio buttons are not inline with the column of first row. And i am getting something like this.

s.n A B C PQR STU VWX YZA CVB SDF WER X 1 O O O O O O O [] 2 O O O O O O O []

Upvotes: 1

Views: 2934

Answers (1)

Neh
Neh

Reputation: 452

You can do the following to RadioButtons:

XML solution :

  1. Instead of using android:drawableRight on radio buttons, use android:drawableLeft.

or

  1. If you want them to share screen width equally you need to set android:layout_width="match_parent" on each View. For details on the implementation you can refer how to increase space between radio buttons in radio group in android

Programmatically Achieving this :

To solve this programmatically you can try adding padding and margins to radio buttons example myButton.setPadding(0, 10, 0, 10);

More information on details are in this example android add padding between radiogroup buttons programmatically

Hope that this helps.

Upvotes: 1

Related Questions