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

久未见 提交于 2019-12-01 18:17:30

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>

Remove .NoActionBar from your MainActivityTheme

<style name="MainActivityTheme" parent="Theme.AppCompat">
        // ................................................
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
</style>

Remove

.NoActionBar

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

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.

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);
}
}

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!