android - Search View uses app icon instead of logo -


android documents explain app logo used everywhere when defined. when search view expands, app icon used instead of app logo , can't find way show app logo when search view in expanded state.

here relevant parts.

manifest file

<application     android:name="myapp"     android:allowbackup="true"     android:icon="@drawable/app_icon"     android:label="@string/app_name"     android:logo="@drawable/app_logo"     android:theme="@style/theme.mytheme" > 

searchable.xml (setting icon doesn't change anything)

<searchable xmlns:android="http://schemas.android.com/apk/res/android"     android:icon="@drawable/app_logo"     android:label="@string/app_name"     android:hint="@string/search_hint" > </searchable> 

menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android" >      <item         android:id="@+id/menu_search"         android:actionviewclass="com.actionbarsherlock.widget.searchview"         android:icon="@drawable/ic_search"         android:showasaction="always|collapseactionview" /> 

activity code

searchmanager searchmanager = (searchmanager) getsystemservice(context.search_service); searchview searchview = new searchview(getsupportactionbar().getthemedcontext()); searchview.setsearchableinfo(searchmanager.getsearchableinfo(getcomponentname())); menu.finditem(r.id.menu_search).setactionview(searchview); 

note: use abs searchview same thing happens when switch default searchview.

edit : added screenshots clarity.

here used star image app logo, , android image app icon. first screenshot default view of activity. second 1 view when click search button. shows android image while expect star image.

enter image description here

enter image description here

set logo drawable icon. via theme attribute

<item name="android:icon">@drawable/ab_logo</item> 

or in code

getsupportactionbar().seticon(r.drawable.ab_logo);  

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -