How to style Android SearchView like in Google Play Store app? -


i trying style searchview in toolbar / behave searchview in google play store app. seems wrap searchview in cardview seems integrate button / drawer toggle behavior.

this main activity searchview, has integrated drawer toggle

mainactivity searchview

when click on it, drawer toggle changes arrow (that when clicked remove focus search view)

enter image description here

when click on app in store, go app detail page , have looks iconified version of search view collapsed action item button:

enter image description here

finally if click on search icon expands action item (with kind of ripple animation) , displays way across screen , incorporates button:

enter image description here

when try myself have lot of problems. tried wrap searchview in cardview , put in toolbar. works there padding on left side can't remove (i tried contentinsetstart, doesn't work):

<android.support.v7.widget.toolbar     android:id="@+id/activitycatalogtoolbar"     android:layout_width="match_parent"     android:layout_height="?attr/actionbarsize"     android:background="?attr/colorprimary"     app:popuptheme="@style/apptheme.popupoverlay"     android:theme="@style/apptheme.appbaroverlay"     app:contentinsetstart="0dp"     app:contentinsetleft="0dp">      <android.support.v7.widget.cardview         android:id="@+id/activitycatalogsearchcontainer"         android:layout_height="match_parent"         android:layout_width="wrap_content"         android:layout_gravity="end"         android:layout_margintop="4dp"         android:layout_marginbottom="4dp"         android:layout_marginright="8dp"         android:layout_marginleft="8dp"         app:cardcornerradius="4dp"         app:cardelevation="8dp">          <android.support.v7.widget.searchview             android:id="@+id/activitycatalogsearch"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:queryhint=""             android:iconifiedbydefault="false"/>      </android.support.v7.widget.cardview>  </android.support.v7.widget.toolbar> 

enter image description here

i have tried remove toolbar , replace framelayout. allows me control padding lose toolbar functionalities (up button, etc) , introduces theming problems (icons , text disappear).

does have idea how doing this? don't want add library style widgets exist in framework. thanks!

you might try deep dive project:

https://android.googlesource.com/platform/packages/apps/dialer/

for lollipop or marshmallow, or n has searchedittextlayout need:

advantage

  • a code made google, not third party.

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -