title: Why first click on the ImageView is not working?
body: <p>I have read through other posts. I can't able to find the solution still.</p>
  
  <p>I tried putting</p>
  
  <pre><code>android:focusableInTouchMode="false"
  android:focusable="false"
  </code></pre>
  
  <p>not worked.
  I have included</p>
  
  <pre><code>android:clickable="true"
  </code></pre>
  
  <p>not worked.</p>
  
  <p>In Java code, I have included </p>
  
  <pre><code>  imgLeft.setOnFocusChangeListener(new View.OnFocusChangeListener() {
          public void onFocusChange(View v, boolean hasFocus) {
              if (!hasFocus) {
                  v.performClick();
              }
          }
      });
  </code></pre>
  
  <p>aside with the onClickListener().</p>
  
  <p>But still it didn't worked.</p>
  
  <p>Here is my rough layout structure and position of the image view.</p>
  
  <pre><code>  &lt;RelativeLayout&gt;
       &lt;FrameLayout&gt;
          &lt;LinearLayout&gt;
             &lt;Relativelayout&gt;
                &lt;LineatLayout/&gt;
                    &lt;LinearLayout&gt;
                        &lt;LinearLayout&gt;
                            &lt;ImageView    &lt;--- This is the I needed to click.
                              android:id="@+id/imgLeft"
                              android:layout_width="wrap_content"
                              android:layout_height="@dimen/title_img_width"
                              android:src="@drawable/left" 
                              /&gt;  
                        &lt;/LinearLayout&gt;
                    &lt;/LinearLayout&gt;
                &lt;/LinearLayout&gt;
             &lt;/Relativelayout&gt;
          &lt;/LinearLayout&gt;
       &lt;/FrameLayout&gt;
    &lt;/Relativelayout&gt;
  </code></pre>
  
  <p>I am using setOnClickListener for handling the click event.</p>
  
  <pre><code> imgLeft.setOnClickListener(new OnClickListener() {
  
  
          @Override
          public void onClick(View v) {
              //some function here    &lt;-- **This function triggers only after the second click**
          }
      });
  </code></pre>
  
  <p><strong>NOTE:</strong>
  I thoroughly checked the other stackoverflow posts. But none of them solved the problem.. is there any solution for the above</p>
  
  <p>UPDATE: Original code:</p>
  
  <pre><code> &lt;RelativeLayout xmlns:tools="http://schemas.android.com/tools"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/rl_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@drawable/bg_image" &gt;
  
  &lt;FrameLayout
      android:id="@+id/layoutConfiguration"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;ImageView
          android:id="@+id/imageView1"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:scaleType="fitXY"
          android:src="@drawable/bg_image"
          android:visibility="gone" /&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical" &gt;
  
          &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="@dimen/menu_header_height" &gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:weightSum="1" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/ll_menu"
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight=".2"
                      android:gravity="center"
                      android:orientation="vertical" &gt;
  
                      &lt;ImageView
                          android:layout_width="@dimen/menu_top_icon"
                          android:layout_height="match_parent"
                          android:layout_gravity="center"
                          android:padding="5dp"
                          android:src="@drawable/menu" /&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight="0.68"
                      android:fontFamily="Oswald-Regular.ttf"
                      android:gravity="center"
                      android:text="Connect Bluetooths"
                      android:textColor="#fff"
                      android:textSize="@dimen/menu_tital_textsize" /&gt;
  
                  &lt;!-- android:padding="@dimen/menu_tital_padding" --&gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight=".2"
                      android:gravity="center"
                      android:padding="15dp"
                      android:text=""
                      android:textColor="#fff"
                      android:textSize="25dp"
                      android:textStyle="bold" /&gt;
              &lt;/LinearLayout&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent" &gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:gravity="center_horizontal"
                  android:orientation="vertical" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/ll_sole"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="@dimen/tital_margin_top"
                      android:gravity="center_horizontal"
                      android:orientation="horizontal"
                      android:weightSum="1" &gt;
  
                      &lt;LinearLayout
                          android:layout_width="0dp"
                          android:layout_height="wrap_content"
                          android:layout_weight="0.3"
                          android:orientation="vertical" &gt;
  
                          &lt;TextView
                              android:id="@+id/tv_leftBattery"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_marginRight="15dp"
                              android:fontFamily="Raleway-Regular.ttf"
                              android:gravity="center"
                              android:text="100%"
                              android:textAppearance="?android:attr/textAppearanceMedium"
                              android:textColor="@android:color/holo_red_dark"
                              android:textSize="16sp"
                              android:visibility="gone" /&gt;
  
                          &lt;ImageView
                              android:id="@+id/imgLeftBluetooth"      
                              android:layout_width="wrap_content"
                              android:layout_height="@dimen/title_img_width"
                              android:src="@drawable/left" /&gt;
  
                          &lt;TextView
                              android:id="@+id/tv_leftBluetooth"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_marginRight="15dp"
                              android:fontFamily="Raleway-Regular.ttf"
                              android:gravity="center"
                              android:text="Not Connected"
                              android:textAppearance="?android:attr/textAppearanceMedium"
                              android:textColor="@android:color/white"
                              android:textSize="14sp" /&gt;
                      &lt;/LinearLayout&gt;
  
                      &lt;LinearLayout
                          android:layout_width="0dp"
                          android:layout_height="wrap_content"
                          android:layout_weight="0.3"
                          android:orientation="vertical" &gt;
  
                          &lt;TextView
                              android:id="@+id/tv_rightBattery"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_marginRight="15dp"
                              android:fontFamily="Raleway-Regular.ttf"
                              android:gravity="center"
                              android:text="100%"
                              android:textAppearance="?android:attr/textAppearanceMedium"
                              android:textColor="@android:color/holo_red_dark"
                              android:textSize="16sp"
                              android:visibility="gone" /&gt;
  
                          &lt;ImageView
                              android:id="@+id/imgRightBluetooth"
                              android:layout_width="wrap_content"
                              android:layout_height="@dimen/title_img_width"
                              android:layout_marginTop="5dp"
                              android:src="@drawable/right" /&gt;
  
                          &lt;TextView
                              android:id="@+id/tv_rightBluetooth"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginLeft="15dp"
                              android:fontFamily="Raleway-Regular.ttf"
                              android:gravity="center"
                              android:text="Not Connected"
                              android:textAppearance="?android:attr/textAppearanceMedium"
                              android:textColor="@android:color/white"
                              android:textSize="14sp" /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:gravity="center_horizontal"
                      android:orientation="vertical"
                      android:paddingTop="@dimen/menu_tital_padding" &gt;
  
                      &lt;ToggleButton
                          android:id="@+id/toggleButton_connectBluetooth"
                          android:layout_width="@dimen/title_img_height"
                          android:layout_height="@dimen/title_text_height"
                          android:layout_centerHorizontal="true"
                          android:layout_centerVertical="true"
                          android:background="@drawable/toggle_selector"
                          android:checked="false"
                          android:padding="5dp"
                          android:text=""
                          android:textOff=""
                          android:textOn="" /&gt;
  
                      &lt;TextView
                          android:id="@+id/tv_toggle_btn"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:gravity="center"
                          android:padding="7dp"
                          android:text="Connect Left Bluetooths Only"
                          android:textAppearance="?android:attr/textAppearanceSmall"
                          android:textColor="@android:color/white" /&gt;
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
  
              &lt;FrameLayout
                  android:id="@+id/fl_balloon"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerVertical="true"
                  android:layout_marginLeft="-15dp"
                  android:gravity="center"
                  android:visibility="gone" &gt;
  
                  &lt;ImageView
                      android:id="@+id/imageView2"
                      android:layout_width="@dimen/balloon_width"
                      android:layout_height="@dimen/balloon_height"
                      android:layout_gravity="center"
                      android:scaleType="fitXY"
                      android:src="@drawable/balloon" /&gt;
  
                  &lt;TextView
                      android:id="@+id/textView2"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:layout_marginLeft="7dp"
                      android:fontFamily="Oswald-Regular.ttf"
                      android:gravity="center"
                      android:text="Pair"
                      android:textColor="@android:color/white" /&gt;
              &lt;/FrameLayout&gt;
  
              &lt;TextView
                  android:id="@+id/textView1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_alignParentTop="true"
                  android:layout_centerHorizontal="true"
                  android:fontFamily="Oswald-Regular.ttf"
                  android:text="Configure Bluetooths"
                  android:textAppearance="?android:attr/textAppearanceLarge"
                  android:textSize="@dimen/menu_tital_textsize"
                  android:visibility="gone" /&gt;
  
              &lt;Button
                  android:id="@+id/btn_next"
                  android:layout_width="wrap_content"
                  android:layout_height="@dimen/menu_top_icon"
                  android:layout_alignParentBottom="true"
                  android:layout_centerHorizontal="true"
                  android:layout_marginBottom="29dp"
                  android:background="@drawable/button_box"
                  android:padding="3dp"
                  android:text="Continue"
                  android:textColor="@android:color/white"
                  android:textSize="15dp"
                  android:textStyle="bold" /&gt;
          &lt;/RelativeLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/FrameLayout&gt;
   &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The id of the clicks that were performed are
  imgLeftBluetooth and imgRightBluetooth. These two imageviews were triggering only after <strong>2nd click</strong>.</p>