Why do the Android Keyboard pops up when adding a ListView -
i'm facing weird problem when adding listview
layout.
my layout contains 2 edittext
, when start activity, keyboard doesn't pop automatically. when add listview
anywhere in layout, keyboard pop when activity starts.
i know there many ways hide keyboard one: getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_state_hidden)
, may have seen other solutions problems here , here question not how prevent why happening ?
i have created simple example demonstrate behavior
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/black" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="chadi.projects.code.testkeyboardactivity" > <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" /> <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="20dp" android:background="@android:color/white" /> <listview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="20dp" /> </linearlayout>
if listview
doesn't exist, keyboard don't show up. if replace listview
other views, still doesn't show up. when add simple listview
(even wihtout populating anything), keboard showing up.
why happening?
try on manifest file
<activity android:name=".myactivity" android:configchanges="orientation|screensize|keyboardhidden" android:windowsoftinputmode="statehidden" />
Comments
Post a Comment