Android 向左填充 TextView 中的文本,其中包含左侧的图像和右侧的文本 [英] Android padding left for a text in a TextView which contains an image on left and text on right
本文介绍了Android 向左填充 TextView 中的文本,其中包含左侧的图像和右侧的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 TextView,它在左侧包含一个图像,在右侧包含一个文本:
I have a TextView which contains an image on the left side and text on the right side:
我想在垂直线和文本之间创建一个空格.
I would like to create a space between the vertical line and the text.
这是我的代码:
<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 的填充
Example: Adding a 5dp padding between the text and the left-side drawable
<TextView
android:id="@+id/locationDetailsTitleTextView"
...
android:drawableLeft="@drawable/balloon_line"
android:drawablePadding="5dp"/>
这篇关于Android 向左填充 TextView 中的文本,其中包含左侧的图像和右侧的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文