2017-06-20 3 views
1

Bearbeiten Sie auf meiner App-Registrierungsseite den Text hier. In diesem Edittext möchte ich Fließtext anzeigen. aber ich versuche, dies Code unten, aber nicht working.Anybody bitte erzählen, dass ..Wie setze ich Fließtext in EditText?

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.citrin.popeye.dev.popeye.Registration"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <TextView 
     android:id="@+id/signupttl" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_marginTop="25dp" 
     android:text="Register" 
     android:textSize="24dp" 
     android:layout_weight="1" 
     android:textColor="#000000"/> 
    <TextView 
     android:id="@+id/signupttl1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_marginTop="6dp" 
     android:text="Sign up to create an account." 
     android:textSize="15dp" 
     android:layout_weight="1"/> 

    <android.support.design.widget.TextInputLayout 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:textColorHint="#BDBDBD" 
     android:layout_weight="1"> 
     <EditText 
      android:id="@+id/name" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:layout_marginTop="38dp" 
      android:drawablePadding="20dp" 
      android:textSize="16dp" 
      android:drawableLeft="@drawable/ic_name" 
      android:inputType="textCapSentences" 
      android:hint="Name" 
      android:nextFocusDown="@+id/email"/> 
    </android.support.design.widget.TextInputLayout> 

    <android.support.design.widget.TextInputLayout 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:textColorHint="#BDBDBD" 
     android:layout_weight="1"> 
     <EditText 
      android:id="@+id/email" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:layout_marginTop="16dp" 
      android:drawableLeft="@drawable/ic_email" 
      android:drawablePadding="20dp" 
      android:hint="Email ID" 
      android:inputType="textEmailAddress" 
      android:nextFocusDown="@+id/nation" 
      android:textSize="16dp" /> 
    </android.support.design.widget.TextInputLayout> 

    <android.support.design.widget.TextInputLayout 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:textColorHint="#BDBDBD" 
     android:layout_weight="1"> 
     <EditText 
      android:id="@+id/nation" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:drawableLeft="@drawable/ic_flag" 
      android:layout_marginTop="16dp" 
      android:drawablePadding="20dp" 
      android:textSize="16dp" 
      android:inputType="textCapWords" 
      android:hint="Nationality" 
      android:nextFocusDown="@+id/cor"/> 
    </android.support.design.widget.TextInputLayout> 

    <android.support.design.widget.TextInputLayout 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:textColorHint="#BDBDBD" 
     android:layout_weight="1"> 
     <EditText 
      android:id="@+id/cor" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:drawableLeft="@drawable/ic_country" 
      android:layout_marginTop="16dp" 
      android:inputType="textCapWords" 
      android:textSize="16dp" 
      android:drawablePadding="20dp" 
      android:hint="Country of Residence" 
      android:nextFocusDown="@+id/pass"/> 
    </android.support.design.widget.TextInputLayout> 

    <android.support.design.widget.TextInputLayout 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:textColorHint="#BDBDBD" 
     android:layout_weight="1"> 
     <EditText 
      android:id="@+id/pass" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:drawablePadding="20dp" 
      android:layout_gravity="center" 
      android:drawableLeft="@drawable/ic_pass" 
      android:layout_marginTop="16dp" 
      android:inputType="numberPassword" 
      android:textSize="16dp" 
      android:maxLength="4" 
      android:hint="Digital Secure Key password" 
      android:nextFocusDown="@+id/signup"/> 
    </android.support.design.widget.TextInputLayout> 

    <Button 
     android:id="@+id/signup" 
     android:layout_width="200dp" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_marginTop="40dp" 
     android:text="SIGN UP" 
     android:layout_weight="1" 
     android:textColor="#FFFFFF" 
     android:background="@drawable/btn" 
     android:layout_marginBottom="15dp" 
     android:onClick="onSignUpClick"/> 

</LinearLayout> 

</ScrollView> 

In Unten angebracht i den Screenshot

This is above code screenshot in android studio preview

+1

haben Sie das Design gradle Abhängigkeit für die gleiche hinzugefügt? –

+0

Ich habe das mit diesem android.support.design.widget.TextInputLayout getan. Was ist das Problem von deinem Ende? Welchen Fehler bekommst du? –

+0

https://guides.codepath.com/android/Working-with-the-EditText#displaying-floating-label-feedback –

Antwort

0
compile "com.android.support:design:$supportLibraryVersion" 

in Ihrer build.gradle Datei

+0

Was ist die neueste Version der Support-Bibliothek? – spodee

+0

Bitte überprüfen Sie diesen Link für die neuesten Bibliotheksupdates [Android-Support-Bibliothek] (https://developer.android.com/topic/libraries/support-library/revisions.html) – jaffar

0

Ich glaube, Sie die gradle Dateiabhängigkeit verpasst haben, bitte Überprüfen Sie die Entwurfsabhängigkeit. es ist in meinem Fall Arbeit.

compile 'com.android.support:design:xx.x.x' 
0

diese Abhängigkeit in Ihrem build.gradle hinzufügen (Modul: app)

Kompilierung ‚com.android.support:design: 25.2. '0

ändern 25.2.0 mit Ihrer Unterstützung Bibliothek Version

Ich hoffe, das wird dir helfen!

0

Ich glaube, Sie diese zwei Abhängigkeit hinzufügen sollten

compile 'com.android.support:appcompat-v7:25.3.1' 
compile 'com.android.support:design:25.3.1' 
Verwandte Themen