Reputation: 1570
I have started using TextInputLayout
. I want the hint of the EditText
to align in the center. But for for some reason the hint isn't getting aligned to the center. However, once I start typing in the EditText
field, the text is tetting aligned to the centre. Please help me with the proper alignment. I want my hint to be center aligned as well.
<android.support.design.widget.TextInputLayout
android:id="@+id/dobLyt"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/dob"
style="@style/MyEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:hint="Date of Birth"
android:inputType="number"
android:textColor="#333333"
android:textSize="15dp" />
</android.support.design.widget.TextInputLayout>
Upvotes: 1
Views: 1876
Reputation: 401
use this
<EditText
android:id="@+id/et"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:ems="10"
android:gravity="center_vertical|center_horizontal"
android:inputType="numberDecimal"/>
Upvotes: 1