I have a menu item as explained in How do I add a button as a menu item?. When I use an icon, I can click on the icon fine. But when I use an actionLayout
, I am getting no response on click. Here is the button the actionLayout
points to:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/my_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginRight="15dp"
android:background="#999999"
android:text="Apple" />
</RelativeLayout>
Any ideas how to fix this problem? The idea is to use my own view instead of a drawable.
I cannot speak from experience but I have found this code fragment that might help you. (I believe the actionbar item is an icon first an actionbar when activated)
}
Link: http://developer.android.com/guide/topics/ui/actionbar.html
Actually I figure it out. I use
with getActionView