文本输入布局 Xamarin(C#)
TextInputLayout Xamarin(C#)
我正在为 Xamarin 编写应用程序 Android。
我尝试使用TextInputLayout
这是我的 axml 代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main_bck">
<android.support.design.widget.TextInputLayout
android:id="@+id/usernameWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="300dp">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:hint="Username" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/passwordWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/usernameWrapper"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/username"
android:inputType="textPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="password" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
我需要在屏幕中央设置Edit Text
。
我该怎么做?
谢谢
在 TextView 中使用它
android:layout_gravity="center_vertical"
或横向
android:layout_gravity="center_horizontal"
我正在为 Xamarin 编写应用程序 Android。
我尝试使用TextInputLayout
这是我的 axml 代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main_bck">
<android.support.design.widget.TextInputLayout
android:id="@+id/usernameWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="300dp">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:hint="Username" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/passwordWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/usernameWrapper"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/username"
android:inputType="textPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="password" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
我需要在屏幕中央设置Edit Text
。
我该怎么做?
谢谢
在 TextView 中使用它
android:layout_gravity="center_vertical"
或横向
android:layout_gravity="center_horizontal"