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
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>
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 !!!
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);
}
}
Remove .NoActionBar from your MainActivityTheme
<style name="MainActivityTheme" parent="Theme.AppCompat">
// ................................................
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
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.
Remove
.NoActionBar
from your style, because you already use from a windowNoTitle=false
and windowActionBar=false
in your Theme.