Getting AppCompat does not support the current theme features exception after upgrading to version AppCompat v22.1.0 issue

后端 未结 6 679
孤城傲影
孤城傲影 2021-01-19 01:56

Previously i was using AppCompat with version 21.1.2 in my project for the purpose of material design toggle with toolbar. But after upgrading to AppCompat v22.1.0, my app h

相关标签:
6条回答
  • 2021-01-19 02:32

    Thank you all for your replies. I solved my issue on my own by removing the line

    <item name="android:windowNoTitle">true</item>
    

    The error occurred because of adding windowNoTitle two times as follows

    <item name="android:windowNoTitle">true</item>
    <item name="windowNoTitle">true</item>
    
    0 讨论(0)
  • 2021-01-19 02:32

    in my case i have this code ==>

    <style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
                <item name="android:windowNoTitle">true</item>
                <item name="windowActionBar">false</item>
                <item name="colorPrimary">@color/colorPrimary</item>
                <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
                <item name="colorAccent">@color/colorAccent</item>
    </style>
    

    it works when i delete

    <item name="windowActionBar">false</item>
    

    hope this may also help !!!

    0 讨论(0)
  • 2021-01-19 02:34

    just Use this in your style.xml no other editing is needed

     <style name="AppTheme" parent="Theme.AppCompat">
    
    <!-- theme customizations -->
    
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
     </style>
    

    don't add anything in to activity file please leave it

      public class Main extends ActionBarActivity {
    
     @Override
     protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
    
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
    }
    }
    
    0 讨论(0)
  • 2021-01-19 02:36

    Remove .NoActionBar from your MainActivityTheme

    <style name="MainActivityTheme" parent="Theme.AppCompat">
            // ................................................
            <item name="windowNoTitle">true</item>
            <item name="windowActionBar">false</item>
    </style>
    
    0 讨论(0)
  • 2021-01-19 02:49

    maybe this help some people

    in my case i didnt use .NoActionBar Theme. i just remove android prefix from this item.

    <item name="windowActionBar">false</item>
    

    in addition i use android studio and gradle shot for you is

    'com.android.support:appcompat-v7:22.2.0'
    

    fortunately the error goes away.

    0 讨论(0)
  • 2021-01-19 02:51

    Remove

    .NoActionBar
    

    from your style, because you already use from a windowNoTitle=false and windowActionBar=false in your Theme.

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