EditText-Feld nicht angezeigt
Ich versuche, ein einfaches android-Anwendung. Ich ma mit der android-version 2.3.3. Ich habe den folgenden code für die Anzeige eines EditText Feld in meiner xml-Datei:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/ll1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/username"
android:textColor="#000000" />
<EditText
android:id="@+id/username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:text="" >
<requestFocus />
</EditText>
</LinearLayout>
<LinearLayout
android:id="@+id/ll2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/password"
android:textColor="#000000" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/remember_me"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/remember_me"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/signInButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/signIn" >
</Button>
</LinearLayout>
<LinearLayout
android:id="@+id/ll5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/forgot_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/forgot_password"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/createAccountButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/create_account" >
</Button>
</LinearLayout>
Aber der EditText ist, die nicht angezeigt werden. Alle anderen buttons, textviews und alles wird richtig angezeigt, nur die EditText sind nicht gezeigt. Kann jemand mir bitte sagen, was das problem ist??
-Vielen Dank im Voraus
- Einfach starten Sie Eclipse einmal. Könnte ein Fehler in Eclipse.
- Bitte Geben Sie vollständige code der xml-Datei.
- bitte buchen Sie den gesamten xml-code? ich denke, sobald reinigen Sie das Projekt, dann wird es funktionieren.
- Gerade versucht, hat nicht funktioniert 🙁
- überprüfen Sie einfach, ich habe meine gesamte xml-Datei.
Du musst angemeldet sein, um einen Kommentar abzugeben.
bitte verwenden Sie diese
Geben Sie die id für den TextView und EditText setzen Sie unten, um die TextView
Ihr passiert b'coz der textview hat die Breite als Attribut fill parent /match Elternteil, so dass die textview füllen(Breite) des Bildschirms, dann den text Bearbeiten, gehen Sie aus dem sichtbaren Bereich. um dieses Problem zu lösen Folgen Sie eine der folgenden Methode..
setzen textview Breite wrap_content oder auf eine Feste Breite (ex-50dp). wenn u verwendet wrap_content dann wieder text Bearbeiten können gehen Sie aus dem sichtbaren Bereich, je nach text in der text-Ansicht.
set sowohl in text-anzeigen und Bearbeiten von text die Breite als layout_width="match_parent" und fügen Sie eine weitere Attribut layout_weight="1". jetzt sowohl text-anzeigen und Bearbeiten von text, zu gleichen teilen die Aktien der Breite des übergeordneten Elements.