2011-01-12 6 views
4

私にはいくつかのEditTextコンポーネントがあるアクティビティがあります。アンドロイド。アクティビティの起動時にオートフォーカスされたテキストビュー

アクティビティが開始されると、最初のEditTextsがフォーカスされ、キーボードが表示されます。私はこの「機能」を避けたいと思います(私は、アクティビティの開始後にポップアップ・キーボードがないことを望みます)。

答えて

4

LinearLayoutを作成します(他の種類のレイアウトでも機能しません)。属性android:focusable="true"android:focusableInTouchMode="true"を設定します。マニフェストでの活動要素にwindowSoftInputMode = "adjustPan"

アンドロイドを追加

<!-- 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

はい。それは素晴らしいことです!どうもありがとう :) – davs

関連する問題