Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy the soft keyboard shows or not when an activity starts?
    primarykey
    data
    text
    <p>When comparing our design between developers, we found a strange behavior. After some analysis we went to this observation.</p> <p>When the activity starts, on some cases the keyboard appears but sometimes not.</p> <p>In fact, without a <code>ScrollView</code>, the soft keyboard does not appear by default on an <code>EditText</code>.</p> <pre><code>&lt;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" tools:context=".TestActivity" &gt; &lt;EditText android:id="@+id/editText1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" android:inputType="text" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;/LinearLayout&gt; </code></pre> <p>But when we add a <code>ScrollView</code>, the soft keyboard shows up by default.</p> <pre><code>&lt;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" tools:context=".TestActivity" &gt; &lt;ScrollView android:id="@+id/scrollView1" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" &gt; &lt;EditText android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:inputType="text" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;/ScrollView&gt; &lt;/LinearLayout&gt; </code></pre> <p>It only depends on the presence of the <code>ScrollView</code>. We can fix that with a specific declaration in the <code>AndroidManifest</code>, but this is the default behavior.</p> <p>I and my fellow developer wonder why is this occurring ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload