java.lang.IllegalArgumentException: AppCompat does not support the current theme features

后端 未结 15 1065
你的背包
你的背包 2020-12-04 11:32

I tried to migrate a project from Eclipse to Android studio. Finally I am able to run it, but at a certain point I got this exception, and I found nothing in google about th

相关标签:
15条回答
  • 2020-12-04 12:09

    I solved the issue by my main Activity extending AppCompatActivity :)

    0 讨论(0)
  • 2020-12-04 12:12

    alternative to @sbaar's answer,

    keep windowActionBar to false and add windowNoTitleas well and set it to true.

    ie

       <item name="windowActionBar">false</item>
       <item name="windowNoTitle">true</item>
    
    0 讨论(0)
  • 2020-12-04 12:12

    if you have added <item name="windowActionBar">false</item>, then ,you need to add

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

    to solve the problem.

    0 讨论(0)
  • 2020-12-04 12:12

    I had same issue somewhat, removed android: from my syles.xml as per below;

     <!-- caused crash -->
     <item name="android:windowActionBar">false</item>
     <item name="android:windowNoTitle">true</item>
    
     <!-- didn't cause crash -->
     <item name="windowActionBar">false</item>
     <item name="windowNoTitle">true</item>
    
    0 讨论(0)
  • 2020-12-04 12:12

    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)
  • 2020-12-04 12:16

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

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

    and the error goes away.

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