EditText - Lücke zwischen text und EditText ' s line
Wenn ich text einfügen zu meinem EditText
Feld der text hat eine anormale Kluft zwischen sich selbst und der EditText
's line. Hier ist ein printscreen von meinem terminal, wo Sie sehen können, diese Lücke, die ich spreche, es ist rot markiert.
Ich habe gespielt, um mit text-alignment und Schwerkraft, aber ohne Erfolg.
Hier die XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<TableLayout
android:id="@+id/startJourneyLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/startLocationTxtView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_gravity="start"
android:text="@string/startLocation"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<EditText
android:id="@+id/startLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_column="1"
android:gravity = "bottom"
android:hint="Some text"
android:inputType="text"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="2"
android:src="@drawable/my_ic_location"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/endLocationTxtView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_gravity="start"
android:gravity="center"
android:text="@string/endLocation"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<EditText
android:id="@+id/endLocation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_column="1"
android:inputType="text"/>
</TableRow>
<Button
android:id="@+id/goButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="@string/go"/>
</TableLayout>
</RelativeLayout>
Kann jemand spot, warum dies geschieht, und erklären Sie mir, wie kann ich es beheben?
--------------- BEARBEITEN -----------------------
Ich habe aktualisiert die XML-code, den ich gepostet in der ursprünglichen Frage um das eigentliche XML-code habe ich auf meiner app, wie gewünscht, in einem Kommentar.
Den ersten printscreen (der eine oben, ist von einem echten Gerät -> Galaxy S4 mit Android 4.4.4 CyanogenMod) und hier ist ein printscreen aus dem emulator mit API 19
Nein, es ist die
EditText
's Linie, wenn Sie die Eingabe von text in es.seine Ordnung, die in meinem Ende..hav u Hinzugefügt jede code für allignment?
Nein, habe ich nicht. Alle layout-code ist, dass
xml
- Datei. Komisch, es funktioniert auf Ihrem Gerät, weil mir ist es genau wie auf dem Bild, das ich gepostet in der Frage.Dies sollte gut funktionieren. Dies geschieht in der Regel im emulator/Vorschau in Android-Studio....in der Praxis ist es nicht tatsächlich tun. Wenn Sie Zugang zu einem anderen Gerät, versuchen Sie es
InformationsquelleAutor dazito | 2015-01-22
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ändern Lücke zwischen EditText text und der unteren Zeile, die Sie verwenden können android:paddingBottom
Ersetzen paddingBottom Wert wie pro Ihre Anforderung.
InformationsquelleAutor Kishan Vaghela
Versuchen
statt
android:layout_height="match_parent"
auf Ihre EditText.EditText
sindandroid:layout_height="match_parent"
InformationsquelleAutor Karakuri