You need to use a Theme.AppCompat theme (or descendant) with this activity. Change to Theme.AppCompat causes other error

前端 未结 14 839
Happy的楠姐
Happy的楠姐 2020-11-27 15:47

I use appcompat v22.1.0 in my App and use Toolbar. Everything was fine when I use Theme.AppCompat.Light.NoActionBar. When I start implement AlertDialog

相关标签:
14条回答
  • 2020-11-27 16:38

    In my case, I had to check and make sure that all styles.xml files use Theme.AppCompat. The standard styles.xml file had that theme but there were also styles(v21).xml, styles(v11).xml and styles(sw600dp).xml that were auto-generated. The simple solution would be to copy and paste the customized default AppTheme style into these folders.

    All the best!

    0 讨论(0)
  • 2020-11-27 16:42

    Please be careful with such problem, i've waisted long long hours on such bug. it happens only on android 4.4.2 version, despite the fact that i'm using the Appcompat theme everywhere, tried to play with all styles and use many other threads and answers.

    the problem was caused by this line:

     <style name="LooperLabTheme"
            parent.theme="@style/Theme.AppCompat.Light.NoActionBar"
            theme="@style/Theme.AppCompat.Light.NoActionBar">
    <style/>
    

    please notice the "parent.theme", i've copied it from some answer in the first days of launching the project that i'm woking on, it should be "parent" without the theme.

     <style name="LooperLabTheme"
                parent="@style/Theme.AppCompat.Light.NoActionBar"
                theme="@style/Theme.AppCompat.Light.NoActionBar">
        <style/>
    

    I just want to help others who are running from thread to thread to find out the fix for his very specific problem, it might be the same as mine, save your time.

    0 讨论(0)
提交回复
热议问题