title: How do you change the theme of an app in Android Studio without getting rendering problems?
body: <p>I have been having this problem in Android studio where I create a project, and I try to change the theme but it always gives me rendering problems.
  I try to change the styles.xml but it doesn't really seem to work.
  Here's the theme I want:
  <a href="https://i.stack.imgur.com/uKvkp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uKvkp.png" alt="Material Light"></a></p>
  
  <p>Whenever I try to select it, I get rendering problems:
  <a href="https://i.stack.imgur.com/1xH6a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1xH6a.png" alt="Rendering Problems"></a></p>
  
  <p>Here's the error details:</p>
  
  <pre><code>java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
  at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:36)
  at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:192)
  at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:186)
  at sun.reflect.GeneratedConstructorAccessor271.newInstance(Unknown Source)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
  at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
  at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
  at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186)
  at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334)
  at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345)
  at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
  at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
  at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
  at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
  at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
  at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
  at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
  at com.android.tools.idea.rendering.RenderTask.lambda$inflate$72(RenderTask.java:659)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>As seen from the first line of the error log, it says </p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.</p>
  </blockquote>
  
  <p>So, Naturally I select the Appcompat Theme like so:
  <a href="https://i.stack.imgur.com/H03Zi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H03Zi.png" alt="AppCompat"></a></p>
  
  <p>And this works without any problems:
  <a href="https://i.stack.imgur.com/gvT9n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gvT9n.png" alt="AppCompat Theme"></a></p>
  
  <p>MainActivity.java file as requested:</p>
  
  <pre><code> package com.example.moham.currencyconverter;
  import android.os.Bundle;
  import android.support.design.widget.FloatingActionButton;
  import android.support.design.widget.Snackbar;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.View;
  import android.view.Menu;
  import android.view.MenuItem;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
         FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
          fab.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                          .setAction("Action", null).show();
              }
          });
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.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();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>How can I make sure that I can use any theme I want and make it work without rendering problems?</p>
  
  <p>edited the java file to extend Activity, and that didn' solve the problem.
  Instead, I now have an additional problem in the java code:
  <a href="https://i.stack.imgur.com/7ct3o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7ct3o.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/ys941.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ys941.png" alt="java file"></a></p>