title: Android EditText focus issue, wrong EditText
body: <p>EditText is driving us crazy! really!</p>
  
  <p>We have an issue in the login screen for our app. It contains two EditTexts but only the first (Username) gets focussed, by means of the SoftKeyboard does only show up if the username EditText is touched/clicked. 
  Once the username EditText has been clicked, and therefore the SoftKeyboard is visible, when then touching/clicking the password EditText it shows focussed (the cursor is blinking in the password EditText) but input from the Keyboard will be inserted in the username EditText.</p>
  
  <p>Now the funny part. We have tried to turn it off and on again, by means of the screen (by pressing the power button), and then, surprise, everything works as expected.</p>
  
  <p>Are we missing something?</p>
  
  <p>We tried quite everything:</p>
  
  <ul>
  <li>flattened the view hierarchy</li>
  <li>layout with only one linear layout containing views</li>
  <li>focusable, focusable in touch mode</li>
  <li>remove fill viewport from parent ScrollView</li>
  <li>converted Fragments to Activities</li>
  </ul>
  
  <p>We are using Android Design Support Library v23.1.1 and AppCompat Library v23.1.1</p>
  
  <p><a href="http://i.stack.imgur.com/9pgpx.png" rel="nofollow">Screenshot of the login screen</a></p>
  
  <p>LoginFragment.java</p>
  
  <pre><code>public class LoginFragment extends Fragment {
  
  private LoginButton fbLoginButton;
  private EditText etxUsername;
  private EditText etxPassword;
  private Button btnLogin;
  private Button btnRegister;
  private Button btnRequestPassword;
  private ImageView backgroundImage;
  private View content;
  
  @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup   container, Bundle savedInstanceState) {
          View root = inflater.inflate(R.layout.fragment_login, container, false);
          fbLoginButton = (LoginButton) root.findViewById(R.id.fb_login);
          fbLoginButton.setFragment(this);
          content = root.findViewById(R.id.content);
          etxUsername = (EditText) root.findViewById(R.id.etx_username);
          etxPassword = (EditText) root.findViewById(R.id.etx_password);
          btnLogin = (Button) root.findViewById(R.id.btn_login);
          btnLogin.setOnClickListener(v -&gt; login());
          btnRegister = (Button) root.findViewById(R.id.btn_register);
          btnRegister.setOnClickListener(v -&gt; showRegister());
          btnRequestPassword = (Button) root.findViewById(R.id.btn_request_password);
          btnRequestPassword.setOnClickListener(v -&gt; requestPassword());
          backgroundImage = (ImageView) root.findViewById(R.id.backgroundImage);
          return root;
      }
  }
  </code></pre>
  
  <p>fragment_login.xml</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:app="http://schemas.android.com/apk/res-auto"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"&gt;
  
      &lt;ImageView
          android:id="@+id/backgroundImage"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_centerVertical="true"
          android:scaleType="centerCrop"/&gt;
  
      &lt;ScrollView
          android:id="@+id/content"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:fillViewport="true"
          android:layout_centerInParent="true"
          android:background="@color/transparent_black"&gt;
  
          &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              android:padding="16dp"&gt;
  
              &lt;LinearLayout
                  android:id="@+id/login_form"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"&gt;
  
                  &lt;ImageView
                      android:layout_width="150dp"
                      android:layout_height="150dp"
                      android:layout_gravity="center"
                      android:layout_marginBottom="@dimen/activity_vertical_margin"
                      android:padding="@dimen/activity_horizontal_margin"
                      android:src="@drawable/login_logo"/&gt;
  
                  &lt;LinearLayout
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:gravity="center"
                      android:minHeight="48dp"
                      android:orientation="horizontal"&gt;
  
                      &lt;ImageView
                          android:layout_width="24dp"
                          android:layout_height="24dp"
                          android:layout_marginRight="32dp"
                          android:src="@drawable/ic_w_user_24"/&gt;
  
                      &lt;EditText
                          android:id="@+id/etx_username"
                          style="@style/AccountManagerEditText.Light"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:hint="@string/username_or_email"
                          android:focusable="true"
                          android:nextFocusDown="@+id/etx_password"
                          android:inputType="text"/&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:gravity="center"
                      android:minHeight="48dp"
                      android:orientation="horizontal"&gt;
  
                      &lt;ImageView
                          android:layout_width="24dp"
                          android:layout_height="24dp"
                          android:layout_marginRight="32dp"
                          android:src="@drawable/ic_w_password_24"/&gt;
  
                      &lt;EditText
                          android:id="@+id/etx_password"
                          style="@style/AccountManagerEditText.Light"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:focusable="true"
                          android:hint="@string/password"
                          android:inputType="textPassword"/&gt;
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
  
              &lt;Button
                  android:id="@+id/btn_request_password"
                  style="@style/VLButtonFlat.Light"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:layout_marginTop="@dimen/spacing"
                  android:text="@string/forgot_password"
                  android:textAllCaps="false"
                  android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                  android:textColor="@color/white"/&gt;
  
              &lt;Button
                  android:id="@+id/btn_login"
                  style="@style/VLButton"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:text="@string/login"/&gt;
  
  
              &lt;TextView
                  style="@style/TextAppearance.AppCompat.Body1"
                  android:layout_width="wrap_content"
                  android:layout_height="38dp"
                  android:autoLink="all"
                  android:clickable="true"
                  android:layout_gravity="center"
                  android:gravity="center"
                  android:text="or"
                  android:textColor="@color/white"/&gt;
  
              &lt;com.facebook.login.widget.LoginButton
                  android:id="@+id/fb_login"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:layout_marginBottom="@dimen/activity_vertical_margin"
                  android:layout_marginTop="@dimen/activity_vertical_margin"/&gt;
  
              &lt;Button
                  android:id="@+id/btn_register"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:layout_weight="1"
                  android:text="@string/create_new_account"
                  android:textAllCaps="false"
                  android:textAppearance="@style/TextAppearance.AppCompat.Caption"/&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>EDIT:
  Added styles</p>
  
  <pre><code>&lt;resources
  xmlns:tools=" http://schemas.android.com/tools"
  tools:ignore="MissingPrefix"&gt;
  
  &lt;style name="AccountManagerTheme.Dark" parent="Theme.AppCompat"&gt;
      &lt;item name="colorPrimary"&gt;@color/black&lt;/item&gt;
      &lt;item name="colorPrimaryDark"&gt;@color/black&lt;/item&gt;
      &lt;item name="colorAccent"&gt;@color/dirty_white&lt;/item&gt;
      &lt;item name="android:textColorPrimary"&gt;@color/black&lt;/item&gt;
      &lt;item name="android:textColorSecondary"&gt;@color/dirty_white&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="AccountManagerEditText.Light" parent="Base.Widget.AppCompat.EditText"&gt;
      &lt;item name="android:theme"&gt;@style/AccountManagerTheme&lt;/item&gt;
      &lt;item name="android:textAppearance"&gt;@style/TextAppearance.AppCompat.Body1&lt;/item&gt;
      &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
      &lt;item name="android:minHeight"&gt;48dp&lt;/item&gt;
      &lt;item name="android:textColorHint"&gt;@color/dirty_white&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="AccountManagerEditText.Dark" parent="Base.Widget.AppCompat.EditText"&gt;
      &lt;item name="android:theme"&gt;@style/AccountManagerTheme.Dark&lt;/item&gt;
      &lt;item name="android:textAppearance"&gt;@style/TextAppearance.AppCompat.Body1&lt;/item&gt;
      &lt;item name="android:textColorHint"&gt;@color/dirty_white&lt;/item&gt;
      &lt;item name="android:minHeight"&gt;48dp&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p></p>