开发者

android. Autofocused textview on activity startup

I have a activity, which view have a several EditText components.

When activity starts, the first of EditText开发者_运维问答s became focused and keyboard appears. I would like to avoid this 'feature' ( I mean I want that there will be no popup keyboard after activity started)


Create a LinearLayout (I dunno if other kinds of Layout's will work). Set the attributes android:focusable="true" and android:focusableInTouchMode="true".

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


Try adding

android:windowSoftInputMode="adjustPan"

to the activity element in your manifest.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜