I switched from ABS to AppCompat with material theme (for API21 only)
My configuration file is as follows:
<application android:theme= "@style/appstyle" <--values folder--<style name= "Appstyle" parent= "@ Style/audiorectheme "><style name=" Audiorectheme "parent=" @style/theme.appcompat.light "> <!-- VALUES-V21 folder--><style name= "Audiorectheme" parent= "@android: Style/theme.material.light" >
My activity:
public class Audiorecactivity extends fragmentactivity
Currently, the action bar in my app is not shown in the version below Android 5.0 and is displayed as normal in Android 5.0
Added: Since I used Android 5.0 Lollipop Material theme, if I inherit actionbaractivity,app it will crash
Processing methods
First, you can use APPCOMPAT-V7 or built-in themes, but not for the same activity at the same time. Here you have used Theme.AppCompat.Light in some places and used Theme.Material.Light in other places, which not only is not necessary, but also causes AFAIK to not work properly, all API levels, If you want to use Theme.AppCompat.Light, you have to use the API levels
Second, if you want to use APPCOMPAT-V7 and Theme.AppCompat.Light, you need to inherit from Actionbaractivity.
On the problem of crashes, you need to create 2 separate activity, you can not allow an activity to inherit actionbaractivity and not inherit actionbaractivity, You need Actionbaractivity's appcompat-v7, which is why it crashes.
Original address: http://www.itmmd.com/201412/289.html
This article by Meng Meng's IT person to organize the release, reprint must indicate the source.
Actionbar does not appear in versions below Android 5.0