我有一个 TextView,它包含左侧的图像和右侧的文本:
我想在垂直线和文本之间创建一个空格。
这是我的代码:
<TextView
android:id="@+id/locationDetailsTitleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/map_activity_location_details_dialog_title"
android:textColor="@color/actionbar_title_color"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:drawableLeft="@drawable/balloon_line" />
我该怎么做?
更新
这是我在 balloon_line
中使用的 Drawable
:
最佳答案
您是否尝试过使用 android:drawablePadding
?
示例:在文本和左侧可绘制对象之间添加 5dp 的内边距
<TextView
android:id="@+id/locationDetailsTitleTextView"
...
android:drawableLeft="@drawable/balloon_line"
android:drawablePadding="5dp"/>
关于Android 在 TextView 中向左填充文本,其中包含左侧的图像和右侧的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12433676/