So i am making an application for school. We have to use Android studio. I want to make a bar with an icon and a placeholder (android: hint). When i make this with this code, the hint text is at the left of the box.
<EditText
android:layout_width="280dp"
android:layout_height="55dp"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/email"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@drawable/email"
android:hint="Email" <---
/>
When i do it like this, the hint text is centered:
<EditText
android:layout_width="280dp"
android:layout_height="55dp"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/email"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@drawable/email"
android:hint="Email"
android:gravity="center" <---
/>
How can i change the place of my hint text in other ways? I want it to be in 1/3 of the box. But i have no idea how to do it.
Thanks in advance
Just dont use the gravity and use padding left :).
<EditText
android:layout_width="280dp"
android:layout_height="55dp"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/email"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@drawable/email"
android:hint="Email"
android:paddingLeft="70dp" />