2011-01-12 23 views
4

Ich habe eine Aktivität, die mehrere EditText-Komponenten enthält.android. Autofokus-Textansicht beim Start der Aktivität

Wenn die Aktivität beginnt, wird der erste von EditTexts fokussiert und die Tastatur erscheint. Ich möchte dieses 'Feature' vermeiden (Ich meine, ich möchte, dass es keine Popup-Tastatur nach der Aktivität gestartet wird)

Antwort

4

Erstellen Sie ein LinearLayout (Ich weiß nicht, ob andere Arten von Layouts funktionieren). Stellen Sie die Attribute android:focusable="true" und android:focusableInTouchMode="true" ein.

<!-- Dummy item to prevent AutoCompleteTextView from receiving focus --> 
<LinearLayout 
    android:focusable="true" android:focusableInTouchMode="true" 
    android:layout_width="0px" android:layout_height="0px"/> 

<!-- :nextFocusUp and :nextFocusLeft have been set to the id of this component 
    to prevent the dummy from receiving focus again --> 
<AutoCompleteTextView android:id="@+id/text" 
     android:layout_width="fill_parent" android:layout_height="wrap_content" 
     android:nextFocusUp="@+id/text" android:nextFocusLeft="@+id/text"/> 
+0

Ja. Das ist großartig! Danke vielmals :) – davs

1

Versuchen Hinzufügen

android: windowSoftInputMode = "adjustPan"

auf das Aktivitätselement in Ihrem Manifest.

Verwandte Themen