Don Box
Don Box

Reputation: 3336

Using ActionBar in AppCompatActivity

Can I still use ActionBar in AppCompatActivity? Are there any issues on using it from Android 6 to Android 4?

I know Toolbar is the new ActionBar, but if I still want to use ActionBar, is this is safe? The reason I don't want to use toolbar is because I'm already skinning the ActionBar.

Btw, I see a huge fragmentation in the API, almost confusing I would say. There's Activity, AppCompatActivity and setActionBar, setSupportActionBar and ActionBar/Toolbar...

Upvotes: 0

Views: 4931

Answers (2)

Naresh Narsing
Naresh Narsing

Reputation: 785

Using Toolbar will be a great option it can be highly customizable, which means you can add navigation buttons, logos, titles, subtitle, action menu items, or even your own custom views. If you still want ActionBar,You need to use getSupportActionBar() while using AppCompatActivity

You can also check customizing option which toolbar provide to that of actionbar

Upvotes: 4

OBX
OBX

Reputation: 6114

Simple Answer: You need to use getSupportActionBar() if you are using AppcompatActivity irrespective of what version your app is running.

Recommended: Should you choose to use the new Toolbar instead of ActionBar, because it's way too flexible.

Upvotes: 2

Related Questions