Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SearchView query hint before clicking it

I have a search view and I have a query hint attribute. However the hint appears only after clicking on the search view. Is there a way to make it appear before it has been clicked?

<SearchView
        android:id="@+id/searchView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/textView4"
        android:layout_marginBottom="14dp"
        android:layout_marginTop="30dp"
        android:queryHint="Search" />

enter image description here

enter image description here

I have seen another SO question with a similar query, but it wasn't solved. That's why I am asking again.

like image 815
ichigo gyuunyuu Avatar asked Nov 06 '15 12:11

ichigo gyuunyuu


1 Answers

Use this XML:

android:queryHint="hint"
app:queryHint="hint"
app:defaultQueryHint="hint"
android:iconifiedByDefault="false"  // this line
app:iconifiedByDefault="false"

app used for {android.support.v7.widget.SearchView}

like image 173
Ali Bagheri Avatar answered Oct 05 '22 07:10

Ali Bagheri