TextInputLayout Xamarin(C#)

本文关键字:Xamarin TextInputLayout | 更新日期: 2023-09-27 18:09:29

我正在为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设置在屏幕中央

我该怎么做?

谢谢

TextInputLayout Xamarin(C#)

在TextView中使用

android:layout_gravity="center_vertical"

或水平

android:layout_gravity="center_horizontal"