Actionbar does not appear in versions below Android 5.0

Source: Internet
Author: User

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" >

&NBSP;


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.