Reputation: 1111
I am making an android app. I need to add a button to the title bar of an activity. I cannot put it in the action bar because of backward compatibility problems. I searched a lot but couldn't find a satisfactory solution for this. Thanks.
Upvotes: 0
Views: 592
Reputation: 1007544
Action bar requires API level 11 to work, my app's minimum is 9
Use a backport, like ActionBarSherlock, which offers action bars back to API Level 7. More importantly, it does so using an API compatible with the official action bar implementation, and so dropping ActionBarSherlock in a year or two (when you drop support for API Level 9-10) will be fairly easy. And, your app will have a consistent look and feel with other Android apps.
Upvotes: 3
Reputation: 13187
I needed something similar and created a custom title bar as follows:
requestWindowFeature(Window.FEATURE_NO_TITLE);
(if I remember correctly, it is crucial to do this before setting the content view of your activity).Upvotes: 0