Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action Bar Fragment Activity

Tags:

I'm triying to migrate my app from actionbarsherlock to Google's actionbarcompat, but ActionBarFragmentActivity does not exist. Do I have to use ActionBarActivity or there is another way?

Thanks in advance, Diego.

like image 701
niegus Avatar asked Aug 26 '13 19:08

niegus


People also ask

How do I get the activity toolbar in fragment?

Though you can add a Toolbar anywhere within your fragment's view hierarchy, you should generally keep it at the top of the screen. To use the Toolbar in your fragment, provide an ID and obtain a reference to it in your fragment, as you would with any other view.

Can a fragment be an activity?

The fragment is only part of an activity, it basically contributes its UI to that activity.

What is ActionBar in android?

Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button. In general an ActionBar consists of the following four components: App Icon: App branding logo or icon will be displayed here.

What is the purpose of using fragments in an activity?

Fragments introduce modularity and reusability into your activity's UI by allowing you to divide the UI into discrete chunks. Activities are an ideal place to put global elements around your app's user interface, such as a navigation drawer.


1 Answers

Look here. This should help you out.

http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html

An Excerpt:

Extend Activity classes from ActionBarCompat: ActionBarCompat contains one Activity class which all of your Activity classes should extend: ActionBarActivity. This class itself extends from FragmentActivity so you can continue to use Fragments in your application. There is not a ActionBarCompat Fragment class that you need to extend, so you should continue using android.support.v4.Fragment as the base class for your Fragments.

like image 148
josh527 Avatar answered Oct 21 '22 06:10

josh527