你好,我面临一个小问题
我使用 GRAVITY LEFT 使我的文本与视图的左侧对齐,但我想在文本视图内居中,但也与左侧部分对齐
这是我现在所拥有的:
___________________________________
_ _ _ _ _ _| aaaaaaaaaaaaa |_ _ _ _ _ _
_ _ _ _ _ _| aaaaaaaa |_ _ _ _ _ _
_ _ _ _ _ _| aaaaaaaaaaaaaa |_ _ _ _ _ _
-----------------------------------
我想要的是:
___________________________________
_ _ _ _ _ _| aaaaaaaaaaa |_ _ _ _ _ _
_ _ _ _ _ _| aaaaaaaa |_ _ _ _ _ _
_ _ _ _ _ _| aaaaaaaaaaaaaa |_ _ _ _ _ _
-----------------------------------
Where:
_ _ _ _ = 文本视图之外
| = TextView 边缘
我尝试了 android:gravity = "left|center" 但它不起作用,知道吗?
Thanks
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/image_button_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_centerVertical="true">
<ImageView
android:id="@+id/left_button_image"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/spacing_normal"/>
<Textview
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/left_button_image"
android:gravity = "center|left|left"
android:clickable="false"
android:focusable="false"
app:font_name="Roboto-Light.ttf"/>
What i've (text align left but not centered)
What i want (text align left and centered) (I add a padding manually to get the render but it's dirty and will not adapt to all text) :
只需将 Textview 父级指定为:
android:gravity = "center"
只需将 Textview 指定为:
android:gravity = "center_vertical|left|start"
android:layout_margin="20dp"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)