简体   繁体   English

Android Studio和Appcompat

[英]android studio and appcompat

Assuming I'm making a new android project from scratch that targets API 15-21, do I really need the compile 'com.android.support:appcompat-v7:21.0.3' in build.gradle ? 假设我正在从头开始针对API 15-21创建一个新的android项目,我真的需要在build.gradle compile 'com.android.support:appcompat-v7:21.0.3'吗?

Can I remove it and not be worried about it? 我可以删除它而不必担心吗?

do I really need the "compile 'com.android.support:appcompat-v7:21.0.3'" in build.gradle? 我真的需要在build.gradle中“编译'com.android.support:appcompat-v7:21.0.3'”吗?

If you want a Material Design-styled action bar on API Level 7-20 (or, in your case, 15-20), then yes. 如果要在API级别7-20(或者您的情况下为15-20)上使用Material Design样式的操作栏,则可以。 Otherwise, for a minSdkVersion of 15, usually you do not need it. 否则,对于minSdkVersion为15,通常不需要。

Can I remove it and not be worried about it? 我可以删除它而不必担心吗?

You can remove it, but you may need to adjust Java classes (eg, have your activities directly inherit from Activity , not from ActionBarActivity ), menu resources (use android: prefixes for everything, not app: prefixes), and themes (make sure they do not inherit from Theme.AppCompat ). 您可以删除它,但是您可能需要调整Java类(例如,让您的活动直接从Activity继承,而不是从ActionBarActivity继承),菜单资源(对所有内容使用android:前缀,而不对app:前缀)和主题(确保它们不继承自Theme.AppCompat )。 Basically, anything in the project that depends upon appcomat-v7 needs to be adjust to no longer depend upon stuff in appcompat-v7 . 基本上,项目中任何依赖于appcomat-v7需要调整为不再依赖于appcompat-v7东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM