What is Backwards Compatibility in Android Studio?

拥有回忆 提交于 2020-05-24 21:23:09

问题


I'm a newbie to Android Development. Even though I referred the android developer website, I didn't figure out.

On the customize Activity dialog box, when I unchecked the Backwards Compatiblity(Appcompat) in Android Studio 2.3.1 It gave me a hint as:

If false, this activity base class will be Activity instead of AppCompatActivity

Generally, what do android developers prefer? enabling backwards compatibility or without it? Can anyone explain me which one is better.


回答1:


Android apps can be backward-compatible without checking this checkbox.

If false, this activity base class will be Activity instead of AppCompatActivity

Android studio is letting you know that if you uncheck the "Backwards Compatability(Appcompat)" box, then you'll be including & using the library Activity instead of AppCompatActivity. For a more detailed comparison between the two, check this: Activity, AppCompatActivity, FragmentActivity, and ActionBarActivity: When to Use Which?

Generally, what do android developers prefer? enabling backwards compatibility or without it?

A comment written by "CommonsWare" explains this best:

An activity created with that checkbox checked is no more backwards compatible than is one without that checkbox checked. Checking the checkbox gives your app a particular look and feel that will retain that look and feel on some older devices; leaving the checkbox unchecked means that some aspects of your look and feel will be different on pre-Android 5.0 devices. This does not impact the core functionality of the activity, though. – CommonsWare




回答2:


Backwards compatibility allows you to use certain backwards compatible features in your app. They will be able to work on previous versions of Android.

The Android Support Library offers backward-compatible versions of a number of features that are not built into the framework. (Android Support Library website)

For example, instead of Activity, AppCompatActivity will be used and is something that is "backwards" compatible. It can be used all the way back to API level 15.




回答3:


You should generally use AppCompatActivity to support older Android versions. If your app has no need for older android versions, then just use Activity.

Using AppCompatActivity is generally more recommended.



来源:https://stackoverflow.com/questions/43788103/what-is-backwards-compatibility-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!