title: Edittext focus is not changing in android
body: <p>In my layout I am using two <code>Spinner</code> and <code>Editext</code> ,when I click outside the <code>Edittext</code> soft keypad is not hiding and also <code>Edittext</code> focus is not changing..
  My layout file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/ic_bgfind"
      android:focusable="true"
      android:focusableInTouchMode="true"
      android:orientation="vertical"
      android:paddingTop="?android:attr/actionBarSize" &gt;
  
      &lt;TextView
          android:id="@+id/drivernametext"
          android:layout_width="match_parent"
          android:layout_height="@dimen/ui_height"
          android:layout_marginBottom="6dp"
          android:layout_marginLeft="@dimen/ui_margin"
          android:layout_marginRight="@dimen/ui_margin"
          android:layout_marginTop="@dimen/ui_margin"
          android:gravity="center_vertical"
          android:text="@string/drivernametext"
          android:textColor="@color/splashscreen"
          android:textSize="20sp" /&gt;
  
      &lt;Spinner
          android:id="@+id/driverSpinner"
          android:layout_width="match_parent"
          android:layout_height="@dimen/ui_height"
          android:layout_marginBottom="@dimen/ui_margin_bottom"
          android:layout_marginLeft="@dimen/ui_margin"
          android:layout_marginRight="@dimen/ui_margin"
          android:background="@drawable/dropdownbtn" /&gt;
  
      &lt;TextView
          android:id="@+id/carRegNumber"
          android:layout_width="match_parent"
          android:layout_height="@dimen/ui_height"
          android:layout_marginBottom="6dp"
          android:layout_marginLeft="@dimen/ui_margin"
          android:layout_marginRight="@dimen/ui_margin"
          android:gravity="center_vertical"
          android:text="@string/carRegNumber"
          android:textColor="@color/splashscreen"
          android:textSize="20sp" /&gt;
  
      &lt;EditText
          android:id="@+id/carRegNumberedit"
          android:layout_width="match_parent"
          android:layout_height="@dimen/ui_height"
          android:layout_marginBottom="@dimen/ui_margin_bottom"
          android:layout_marginLeft="@dimen/ui_margin"
          android:layout_marginRight="@dimen/ui_margin"
          android:cursorVisible="false"
          android:hint="@string/carRegNumber"
          android:inputType="text"
          android:textColor="@color/brandcolor"
          android:textColorHint="@color/edit_hint"
          android:textSize="16sp" /&gt;
  
      &lt;TextView
          android:id="@+id/inglottext"
          android:layout_width="match_parent"
          android:layout_height="@dimen/ui_height"
          android:layout_marginBottom="6dp"
          android:layout_marginLeft="@dimen/ui_margin"
          android:layout_marginRight="@dimen/ui_margin"
          android:gravity="center_vertical"
          android:text="@string/inglottext"
          android:textColor="@color/splashscreen"
          android:textSize="20sp" /&gt;
  
      &lt;Spinner
          android:id="@+id/inglotspinner"
          android:layout_width="match_parent"
          android:layout_height="@dimen/ui_height"
          android:layout_marginLeft="@dimen/ui_margin"
          android:layout_marginRight="@dimen/ui_margin"
          android:background="@drawable/dropdownbtn" /&gt;
  
      &lt;Button
          android:id="@+id/Done"
          android:layout_width="match_parent"
          android:layout_height="@dimen/ui_height"
          android:layout_margin="@dimen/ui_margin"
          android:background="@drawable/button_shape"
          android:text="@string/Done"
          android:textColor="@android:color/white"
          android:textSize="20sp" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>in programatically i have tried </p>
  
  <pre><code>final EditText carRegEdit = (EditText) findViewById(R.id.carRegNumberedit);
          carRegEdit.setOnFocusChangeListener(new OnFocusChangeListener() {
  
              @Override
              public void onFocusChange(View v, boolean hasFocus) {
  
                  if (!hasFocus) {
                      carRegEdit.clearFocus();
                      InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                      imm.hideSoftInputFromWindow(carRegEdit.getWindowToken(), 0);
                  }
  
              }
          });
  </code></pre>
  
  <p>in <code>Activity</code> declaration I also tried, still soft keypad is not hiding.
  How to hide it?</p>