Here is what I understand about this problem after digging into Android code and creating some test layouts using EditText .
How ScrollView is defined as
public class More ...ScrollView extends FrameLayout { ... }
I tried using FrameLayout as a container for the EditText element. As a result, the soft keyboard does not start.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/editText1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:inputType="text" > <requestFocus /> </EditText> </FrameLayout>
But, as written in the question, using ScrollView launches a soft keyboard (I simplified the xml source).
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/editText1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:inputType="text" > <requestFocus /> </EditText> </ScrollView>
Thus, the element that allows you to launch the soft keyboard is located in the ScrollView source file.
Edit: by creating my own MyFrameLayout class that extends FrameLayout and playing with the code, I found that this is something in the default scrollview style ( R.attr.scrollViewStyle ), which is responsible for displaying the keyboard or not ..
Edit2: finally, the android:scrollbars allows android:scrollbars to automatically launch the keyboard at startup, if present ...
Tok '
source share