2017-06-12 3 views
1

TextInputLayout-Fehlercontainer hat eine große Höhe. Ich möchte die Höhe reduzieren. Wie kann ich das machen? change this heightWie ändere ich TextInputLayout Fehler Container Höhe?

<android.support.design.widget.TextInputLayout 
     android:id="@+id/textInput" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/md_red_100" 
     android:layout_centerInParent="true" 
     app:errorEnabled="true" 
     android:padding="0dp" 
     app:hintEnabled="false"> 

     <EditText 
      android:id="@+id/edittext" 
      style="@style/purpleNormalEdit" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:inputType="text" 
      android:maxLines="1" 
      android:paddingBottom="10dp" 
      android:paddingRight="50dp"/> 
    </android.support.design.widget.TextInputLayout> 

dank

+0

Teilen Sie Xml-Datei –

+0

Ähnliche Frage, aber keine Antwort darauf https://StackOverflow.com/Questions/40756040/How-through-padding-Margin-Top-and-bottom-of-Textinputlayout-error-text – Redman

+0

versuchen Sie es mit 'android: layout_marginTop =" - 10dp "' für Geburtstag Feld – Redman

Antwort

1

Ich hasse Hacks, aber ich habe einen solide Art und Weise der Änderung der Fehlertext Höhe innerhalb eines TextInputLayout nicht gefunden. Daher schlage ich eine matschig Lösung:

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:layout_width="match_parent" 
     android:layout_height="72dp" 
     android:orientation="vertical"> 


     <android.support.design.widget.TextInputLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="-10dp" 
      app:errorEnabled="true"> 

      <com.panera.bread.common.views.PaneraEditText 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:ems="10" 
       android:hint="Generic Hint" 
       android:inputType="text" 
       android:maxLines="1" /> 

     </android.support.design.widget.TextInputLayout> 
    </LinearLayout> 

Ich gewünschte Höhe erhalten für meine TextInputLayout indem sie sie in eine LinearLayout mit der Höhe gepinnt Slapping. Meine TextInputLayout fügt den Inhalt in die Höhe ein und verdeckt die starke Auffüllung des Fehlers, indem ein negativer unterer Rand festgelegt wird.

Verwandte Themen