Android Material Design AppCompat

Kir*_*irk 5 android android-appcompat material-design

我是Android Material Design Concept的新手.我已经创建了一个新项目并添加了材料主题与AppCompat支持前棒棒糖版本,但我的问题是,在Lollipop它显示ActionBar又名工具栏但如果我在前棒棒糖中运行相同它不显示ActionBar.

我是否只需要在我的布局中的任何地方使用工具栏控件,而不管API版本如何?

编辑:

<!-- Base application theme for prelollipop -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="colorPrimary">@color/primary_dark</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
</style>

<!-- Material theme for lollipop-->
<style name="AppTheme" parent="android:Theme.Material.Light">
    <item name="android:colorPrimary">@color/primary</item>
    <item name="android:colorPrimaryDark">@color/primary_dark</item>
</style>
Run Code Online (Sandbox Code Playgroud)

Jar*_*ler 1

每个Activity都需要扩展ActionBarActivity。AppCompat 不使用本机工具栏或操作栏,即使在 Lollipop 上也是如此。

有关更多信息,请参阅:http://android-developers.blogspot.com/2014/10/appcompat-v21-material-design-for-pre.html