2016-09-29 2 views
1

Ich schreibe App für Xamarin Android.TextInputLayout Xamarin (C#)

Ich versuche TextInputLayout

hier zu verwenden ist mein axml Code:

<?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> 

Ich brauche Edit Text auf der Mitte des Bildschirms einzustellen.

Wie kann ich das tun?

Dank

+0

Zentrum horizontal oder vertikal oder beides? –

Antwort

1

diese Verwendung in der Textview

android:layout_gravity="center_vertical" 

oder horizontal

android:layout_gravity="center_horizontal"