Android Custom ActionBar with Search View -


i using custom actionbar library in android app. there want show searchview can not find solution, m working in library
https://github.com/johannilsson/android-actionbar

class

private class exampleaction extends abstractaction {          public exampleaction() {             super(r.drawable.ic_title_export_default);         }          @override         public void performaction(view view) {             toast.maketext(otheractivity.this, "example action",                     toast.length_short).show();         }      }     //use signle action how use multiactions        actionbar actionbar = (actionbar) findviewbyid(r.id.actionbar);        actionbar.addaction(new exampleaction()); 


actually found code searchbar in .cs format how use searchview
https://github.com/zleao/monodroid.actionbar

bro & sis

take @ answer. according answer searchview available support library. add dependency build.gradle

compile 'com.android.support:appcompat-v7:22.0.0' 

and make imports

import android.support.v7.app.actionbaractivity; import android.support.v7.widget.searchview;

according answer worked on api 8 on emulator. more details, check link question , answer itself. hope helps.

update

by adding code

<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:hmkcode="http://schemas.android.com/apk/res-auto"> <item     android:id="@+id/action_search"     android:orderincategory="100"     hmkcode:showasaction="always"     android:icon="@drawable/ic_action_search"     android:title="search"/> <item     android:id="@+id/action_copy"     android:orderincategory="100"     hmkcode:showasaction="always"     android:icon="@drawable/ic_content_copy"     android:title="copy"/> <item     android:id="@+id/action_share"     android:orderincategory="100"     hmkcode:showasaction="always"     android:icon="@drawable/ic_social_share"     android:title="share"/> 

you can achieve this:

enter image description here

you can customize items in way want. more details see example.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -