支持 API 仍然是新应用程序的方式吗?

Is the support API still the way to go for new apps?

我看到官方文档在其文档中使用了支持API:http://developer.android.com/guide/topics/ui/actionbar.html

作为Android的新手,我有一些问题。

仅针对 11 设备以上的 API 级别是否可以?

那样的话,我还能跳过那里提到的支持API吗?

Is is okay to aim for the API level higher than 11 devices only ?

是的。

I still skip using the support API mentioned there ?

我假设您指的是 appcompat-v7 的操作栏向后移植。你不必使用这个。

一些其他库(例如,Android 设计支持库)目前要求您对某些事情使用 appcompat-v7appcompat-v7 还为您提供了旧设备上 Material 设计美学的各个方面,例如操作栏和一些小部件的品牌颜色着色。如果您对这些功能感兴趣,您当然可以使用 appcompat-v7

最低版本取决于您的目标受众。从开发的角度来看,较新的 API 具有更多功能。可以看到版本统计here

目前使用 API 11 的设备已经很旧了,可能不是您的目标受众。

Google 的最新设计标准是使用 Material 在 appcompat-v7 支持库中找到的设计

还有几个其他支持组件向后移植的库 design 对于浮动操作按钮和快捷栏 cardview 卡片浏览量 recyclerview 高效的项目列表

另请注意 AppComapt 22.2.0 的最新版本现在使用 Toolbar 而不是 ActionBar(您可以将工具栏设置为用作 1Actionbar`)

更新

如果您想使用 Material Design(推荐)但仍支持旧版本的 Android,这里是您链接的操作栏指南中的一些更新。

// Extend AppComaptActivity instead of Activity
public class MyActivity extends AppCompatActivity implements ConnectivityService.ConnectivityListener {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.my_activity);
    // Set the toolbar defined in your layout as the ActionBar
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
}

最后一个区别是您的应用主题应该是(或扩展)一些不包含操作栏的变体(例如 Theme.AppCompat.Light.NoActionBar

有很多关于使用 AppCompat 和 Material 设计的其他指南,如果您在不使用 AppComapt 的情况下构建 API 21 之前的应用程序,则链接的 ActionBar 指南是正确的。