Hello i'm facing a little problem
I'm using GRAVITY LEFT to make my text an aligment for the left side of a view but I want to center inside the textview but also align on the left part
Here's what I have now:
___________________________________
_ _ _ _ _ _| aaaaaaaaaaaaa |_ _ _ _ _ _
_ _ _ _ _ _| aaaaaaaa |_ _ _ _ _ _
_ _ _ _ _ _| aaaaaaaaaaaaaa |_ _ _ _ _ _
-----------------------------------
What I want is:
___________________________________
_ _ _ _ _ _| aaaaaaaaaaa |_ _ _ _ _ _
_ _ _ _ _ _| aaaaaaaa |_ _ _ _ _ _
_ _ _ _ _ _| aaaaaaaaaaaaaa |_ _ _ _ _ _
-----------------------------------
Where:
_ _ _ _ = outside of textview
| = the TextView edge
I tried android:gravity = "left|center" but it doesn't work, any idea ?
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
?? if you can post the code part which contain parent oftextview
and thetextview
, it will be easy to resolve your problem. – Coyotillo