Im trying to use a checkbox in actionbar,im using actionbarsherlock.
i've tried very hard to get the checkbox work,now I've made the UI (bu using the setCustomView method),but I'm stucked at catch the check event of the checkbox,I did some research of some similar questions but get the answer that "checkbox cant be used in actionbar ,it can only be used in submemus or etc", I doubt that and wondered whether there is a way to get it work...
here is my UI:
here is my CustomView xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:gravity="center_vertical" >
<CheckBox
android:id="@+id/action_anoni_check"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:checked="false"
android:gravity="center"
android:text="@string/anonymity" />
</LinearLayout>
here is how i added it in my ui:
ActionBar actionBar = getSupportActionBar();
actionBar.setCustomView(R.layout.write_actionbar_top);