我在Eclipse中使用Material Theme拥有项目,如果要在更高版本的Android中使用,我希望该主题已在应用程序中。例如S Converter或Google的应用程序。很简单,您需要这样做才能与以前的版本兼容。
AppCompat库的版本21引入了21之前版本设备的Material主题。
首先,您需要将AppCompat库添加到您的项目中。
完成此操作后,只需将主题更新为Theme.AppCompat
或从以下扩展Theme.AppCompat.Light
:
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
<!-- Set your app's colors for the ActionBar and View widgets here -->
<item name="colorPrimary">@color/my_primary</item>
<item name="colorPrimaryDark">@color/my_primary_dark</item>
<item name="colorAccent">@color/my_accent</item>
</style>
最后,更新您的活动以从AppCompat的扩展ActionBarActivity
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句