johannilsson / android-actionbar

DEPRECATED Android Action Bar Implementation
1.31k stars 564 forks source link

Text instead of Drawables #12

Open robisaks opened 13 years ago

robisaks commented 13 years ago

I'd like to have text as a button in the action bar, in addition to normal drawables. I did some initial research into doing this by drawing text onto a canvas then converting it to a drawable. It seems as though the action bar is expecting the integer for the drawable resource.

johannilsson commented 13 years ago

Oh that is true. Currently it's not possible to do, sorry for the poorly designed api for Action. Guess public int getDrawable(); should have been public Drawable getDrawable(); instead and internally deal with translating resources to drawables.

Changing this would break the api and all users would need to change their code when implementing other actions than IntentActions, but I think it's a reasonable change. I need to think that through and have the users of the action bar feedback on such a change.

Until that I would suggest you to add the text through resources or fork it yourself to be able to do it for now.