سؤال

Is there any way to change the content of the title bar when it's in Tab(If it wasn't in tab I would have done it but tried couldn't find any solution). E.g. Suppose I have created a custom title bar with few buttons on it, and now I want to change the content of the title bar(Drawables, Title and the functionality).

It would be great if someone could tell me if i can implement Action bar in versions below 3.0 ? I am creating this project in 2.1 (I'd like to create action bar from scratch).

or if there's any way beside inserting an image and placing buttons on it(This methodology would be good enough)?

هل كانت مفيدة؟

المحلول

If you're just looking to implement the ActionBar paradigm in pre-Honeycomb versions of Android, I suggest you look into using the ActionBarSherlock library.

The library will automatically use the native action bar when available or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android back through 1.6.

نصائح أخرى

twaddington and pjco's answers are correct, you need to use ActionBarSherlock if you want to be compatible with every SDK levels.

I want to add you can have a custom actionbar or a custom view for your actionbar tabs using the method actionbar.setCustomView(view) or tab.setCustomView(view)

Anyway, play with ActionBarSherlock demos, there are a few cool use cases.

The other option worth looking at is ActionBarCompat, which I think comes with the SDK 14 api demos. However, ActionBarSherlock seems to support many more features so that may be the better solution.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top