问题描述
根据我学到的知识,我能够在相关小部件的分组周围添加一些围栏:
Based on what I learned here, I was able to add some "fences" around groupings of related widgets:
但是,如您所见,第二个/下面的框挤满了第一个单选按钮文本。我需要修改哪个元素以添加一些空间?我是否需要在框本身中添加一些内容,该内容位于可绘制的文件夹中,并且定义如下:
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>
...或内部的LinearLayout或相关的单选按钮(或其封闭的RadioButtonGroup小部件)?这是xml:
...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>
推荐答案
是的,您可以添加一些填充,这将导致增加内部空间:
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>
可以随意尝试4dp以外的其他值(即使顶部/底部,左侧/右侧也不同) )
Feel free to experiment different values other than 4dp (even different for top/bottom, left/right sides)
这篇关于我需要修改哪个元素以在可绘制对象及其封闭的元素之间添加填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!