How can I only show the cursor of an EditText when the keyboard is displayed?
At the moment the cursor is blinking even if the EditText is not active and the keyboard is hidden, which is really annoying.
This is how my layout looks:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_main_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white" >
    <ImageButton
        android:id="@+id/activity_main_add_button"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/button"
        android:contentDescription="@string/desc_add"
        android:onClick="addGame"
        android:src="@android:drawable/ic_input_add"
        android:tint="@color/gray" />
    <View
        android:id="@+id/stub1"
        android:layout_width="2dp"
        android:layout_height="40dp"
        android:layout_toRightOf="@id/activity_main_add_button"
        android:background="@color/light_gray" />
    <ImageButton
        android:id="@+id/activity_main_menu_button"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_toRightOf="@id/stub1"
        android:background="@drawable/button"
        android:contentDescription="@string/desc_add"
        android:onClick="showMenu"
        android:scaleType="fitXY"
        android:src="@drawable/square_button"
        android:tint="@color/gray" />
    <View
        android:id="@+id/stub2"
        android:layout_width="2dp"
        android:layout_height="40dp"
        android:layout_toRightOf="@id/menu_button"
        android:background="@color/light_gray" />
    <EditText
        android:id="@+id/activity_main_search"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:layout_toRightOf="@id/stub2"
        android:background="@drawable/default_background"
        android:gravity="center"
        android:hint="@string/search_game"
        android:inputType="text"
        android:textColor="@color/black"
        android:textSize="20sp"
        android:textStyle="bold" />
    <ListView
        android:id="@+id/activity_main_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/activity_main_add_button"
        android:layout_margin="10dp"
        android:divider="@color/white"
        android:dividerHeight="10dp" >
    </ListView>
</RelativeLayout>
Thanks
 
     
     
     
     
     
    