Ich baue derzeit eine Android-Anwendung, mit der Benutzer Bilder aufnehmen und Details davon schreiben können. Die Anwendung verwendet Sherlock-Bibliotheken.Probleme mit EditText und Soft-Tastatur in einem Fragment
Ich habe ein SherlockFragment implementiert, um das Bild und einige EditText und TextView anzuzeigen, damit Benutzer Informationen des Bildes eingeben können. Wenn jedoch einer der EditText im Fokus ist, werden alle Felder hochgedrückt und die Soft-Tastatur erscheint.
Hier ist mein Layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#FFFFFF">
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="200dip"
android:layout_above="@+id/textView"
android:layout_marginTop="20dip"
android:layout_marginBottom="20dip"
android:contentDescription="desc" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title:"
android:textStyle="bold"
android:layout_above="@+id/editTextSimple"
android:layout_marginBottom="2dip"
android:textSize="15sp"/>
<EditText
android:id="@+id/editTextSimple"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/textView1"
android:layout_marginBottom="4dip">
<requestFocus />
</EditText>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description:"
android:textStyle="bold"
android:layout_above="@+id/editTextSimple1"
android:layout_marginBottom="2dip"
android:textSize="15sp"/>
<EditText
android:id="@+id/editTextSimple1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/textView2"
android:layout_marginBottom="12dip">
</EditText>
<Button android:textColor="#FF000000"
android:id="@+id/submitButton"
android:text="@string/memorySubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="24dip"
android:onClick = "submit"/>
</RelativeLayout>
Von dem, was ich verstehe, in einer Tätigkeit, man diese <activity android:windowSoftInputMode="...." >
im Android Manifest platzieren müssen, um die Ansicht einzustellen, wenn die Soft-Tastatur aufgerufen wird. Wie stellen wir dies jedoch für Fragmente ein?
Hallo Evos! Vielen Dank für Ihre Antwort! Leider funktioniert es immer noch nicht. Ich denke, das Problem könnte an dem "android: layout_above" liegen, obwohl ich mir da nicht ganz sicher sein kann. – user1140240
Haben Sie versucht, in Ihrem Manifest verschiedene Variationen dieses Parameters zu setzen? – Evos
tat ich. Ich erkannte, dass das Problem im Layout selbst und nicht in der Tastatur liegt. Also habe ich eine Scroll-Ansicht implementiert und es funktioniert! Danke für deine Hilfe trotzdem. – user1140240