Why does my Activity extend ActionBarActivity?

后端 未结 6 795
你的背包
你的背包 2020-12-16 12:24

I downloaded the latest SDK version and when I created a new Android project the MainActivity that automatically generated extends ActionBarActivity

相关标签:
6条回答
  • 2020-12-16 13:03

    ActionBarActivity is for backwards-compatibility. So the Android Actionbar will also work on older devices, see documentation.

    Base class for activities that use the support library action bar features.

    You can add an ActionBar to your activity when running on API level 7 or higher by extending this class for your activity and setting the activity theme to Theme.AppCompat or a similar theme.

    It is a subclass of FragmentsActivity and FragmentsActivity extends Activity. ==> so don't worry all things you could do with normal Activities you can also do with an ActionBarActivity.

    0 讨论(0)
  • 2020-12-16 13:08

    Simply Replace ActionBarActivity to Activity Then go to top of the code and replace import android.support.v7.app.ActionBarActivity; to import android.app.Activity;

    0 讨论(0)
  • 2020-12-16 13:20

    My guess is when you created the app, you choose the Action bar setting in eclipse. Please notice ActionBarActivity is an extension of Activity, so all features present in Activity will be present in ActionBarActivity.

    0 讨论(0)
  • 2020-12-16 13:22

    Nowadays latest Android SDK ActionbarActivity only. which is from IDE and Google. No Problem with that. ActionBarActivity Facilitate to your application which works on Older API also. Don't worry. That's is not problem.

    0 讨论(0)
  • 2020-12-16 13:23

    You can simply replace the ActionBarActivity with Activity since ActionBarActivity is an extension of Activity. You can refer the class hierarchy here: http://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html

    0 讨论(0)
  • 2020-12-16 13:28

    If you want to extend Activity class, you may check "Empty Activity" during the project creation trajectory.

    enter image description here

    enter image description here

    0 讨论(0)
提交回复
热议问题