Issue
I want my drawableRight
at the end of my edit text.
As you can see in the picture it is not at the end.
Code of my EditText:
<EditText
android:id="@+id/btnDB"
android:layout_width="300dp"
android:layout_height="52dp"
android:layout_marginTop="20dp"
android:background="@drawable/textfield2r"
android:layout_gravity="center"
android:drawableRight="@drawable/db_ic"
android:ems="10"
android:text="Daten einsehen"
android:textAlignment="viewEnd"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:textColor="#000000"
android:textColorHint="#7A7A7A"
android:textSize="18dp"
tools:ignore="RtlCompat" />
And here the xml of the background:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#EBEBEB"/>
<stroke
android:width="1dp"
android:color="#D30F1D"/>
<padding
android:bottom="0dp"
android:left="0dp"
android:right="0dp"
android:top="0dp"/>
<corners
android:bottomLeftRadius="30dp"
android:bottomRightRadius="30dp"
android:topLeftRadius="30dp"
android:topRightRadius="30dp"/>
</shape>
At the end it should look like this:
Thanks for helping me, kind regards, Jeremy
Solution
Finally i was able to fix it.
I made a RTL linear layout in which i put in my EditText:
<LinearLayout
android:layout_width="match_parent"
android:layoutDirection="rtl"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:background="#00FFFFFF"
android:orientation="vertical">
<EditText
android:id="@+id/btnData"
android:layout_width="300dp"
android:layout_height="52dp"
android:layout_marginTop="20dp"
android:gravity="center_vertical|right"
android:background="@drawable/textfield2r"
android:layout_gravity="center"
android:drawableRight="@drawable/console"
android:ems="10"
android:text="Daten einsehen"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:textColor="#000000"
android:textColorHint="#7A7A7A"
android:textSize="18dp" />
</LinearLayout>
Then I changed the xml of my button background:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#EBEBEB"/>
<stroke
android:width="1dp"
android:color="#D30F1D"/>
<padding
android:bottom="-1dp"
android:left="0dp"
android:right="-8dp"
android:top="0dp"/>
<corners
android:bottomLeftRadius="30dp"
android:bottomRightRadius="30dp"
android:topLeftRadius="30dp"
android:topRightRadius="30dp"/>
Now everything is like i wanted it.
Answered By - Jeremy Brehe
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.