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
when click on it, drawer toggle changes arrow (that when clicked remove focus search view)
when click on app in store, go app detail page , have looks iconified version of search view collapsed action item button:
finally if click on search icon expands action item (with kind of ripple animation) , displays way across screen , incorporates button:
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>
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
Post a Comment