1

Based on what I learned here, I was able to add some "fences" around groupings of related widgets:

enter image description here

But, as you can see, the second/lower box is crowding the first radio button text. Which element do I need to modify to add some space? Do I need to add something to the box itself, which lives in the drawable folder and is defined like this:

<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
    >
<stroke
    android:width="1dp"
    android:color="#f000"
    />
</shape>

...or to the inner LinearLayout, or to the radio button in question (or its enclosing RadioButtonGroup widget)? Here is that xml:

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/box"
    android:orientation="vertical">

. . .

    <RadioGroup
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <RadioButton
            android:id="@+id/radbtnBar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/using_labels_black" />

. . .

    </RadioGroup>
</LinearLayout>
3
  • 1
    Yes, you can add some padding, which will result in som inner space added Commented May 21, 2014 at 18:00
  • To the box drawable, or...??? Commented May 21, 2014 at 18:00
  • In the box. I added an answer Commented May 21, 2014 at 18:05

1 Answer 1

1

Yes, you can add some padding, which will result in som inner space added:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    >
    <padding
        android:left="4dp"
        android:top="4dp"
        android:right="4dp"
        android:bottom="4dp"
    />
    <stroke
        android:width="1dp"
        android:color="#f000"
    />
</shape>

Feel free to experiment different values other than 4dp (even different for top/bottom, left/right sides)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.