Android – how to center and left align prompt text in EditText?
•
Android
This is my layout, which brings the prompts together well, but how to align the prompts to the left, such as the margin of 10dip? (that is, I want it to remain vertically centered but aligned to the left)
<EditText
android:id="@+id/mobilePhoneNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:inputType="number"
android:ellipsize="start"
android:gravity="center"
android:layout_marginTop="10dip"
android:hint="@string/lbl_hint_enter_mobile_phone_number"
android:textSize="14dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:maxLines="1" />
resolvent:
<EditText
android:id="@+id/mobilePhoneNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:ellipsize="start"
android:gravity="left|center_vertical"
android:paddingLeft="5dp"
android:layout_marginTop="10dip"
android:hint="hello world"
android:textSize="14dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:maxLines="1" />
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码