2016-07-29 9 views
4

ProblemPosition ändern schwimmender Beschriftungstext von TextInputLayout

Die schwimmende Beschriftungstext wird über den Rand des EditText Feld erscheint. Wie kann es über das vordefinierte Niveau angehoben werden?

Mein Code:

<android.support.design.widget.TextInputLayout 
    android:id="@+id/input_layout_usernameL" 
    android:theme="@style/MyTextInputLayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <EditText 
     android:id="@+id/etUsername" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:background="#ffffff" 
     android:hint="Username" 
     android:padding="10dp"/> 


</android.support.design.widget.TextInputLayout> 
+1

Bitte teilen Sie Ihren Code –

Antwort

0

, dass wegen der Polsterung passieren meine, überprüfen Sie bitte Ihre xml mit der folgenden

<android.support.design.widget.TextInputLayout 
android:id="@+id/input_layout_name" 
android:layout_width="match_parent" 
android:layout_height="wrap_content"> 

<EditText android:id="@+id/input_name" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:singleLine="true" 
android:hint="@string/hint_name" /> 
</android.support.design.widget.TextInputLayout> 
0

dies nicht gut funktionieren, wenn Sie ziehbar nehmen so tun, um EditText dies wie und geben paddding sowohl

<android.support.design.widget.TextInputLayout 
android:id="@+id/input_layout_usernameL" 
android:theme="@style/MyTextInputLayout" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/yourdrawablerectagular" 
android:padding="10dp" 
> 

<EditText 
    android:id="@+id/etUsername" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="10dp" 
    android:background="@null" 
    android:hint="Username" 
    android:padding="10dp"/> 


    </android.support.design.widget.TextInputLayout> 
+0

Hinzufügen von Padding zu beiden funktioniert nicht. – TheHardRock

+0

Wie Sie Bild zeigen, verwenden Sie Hintergrund zu Ihrem Editiertext richtig? –

+0

@TheHardRock Bitte fügen Sie null zu edittext background und setbackground zu TextInputLayout hinzu und geben Sie auch Padding zu beiden. –

0

Das hört sich vielleicht ein bisschen hacky an, aber auch deine Frage. : p

Probieren Sie es aus.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="10dp" 
    android:orientation="vertical" > 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="13dp" 
     android:background="@drawable/test" 
     android:padding="38dp" /> 

    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_layout_name" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 

     <EditText 
      android:id="@+id/input_name" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@null" 
      android:hint="Email" 
      android:padding="10dp" 
      android:singleLine="true" /> 
    </android.support.design.widget.TextInputLayout> 

</RelativeLayout> 

Ergebnis:

enter image description here

Ich weiß, das nicht richtig ist, dass aber noch viel zu tun.

Ich hoffe, es wird Ihnen helfen.

Verwandte Themen