1. 程式人生 > >AndroidStudio xml不顯示內容出現:Rendering Problems The following classes could not be instantiated

AndroidStudio xml不顯示內容出現:Rendering Problems The following classes could not be instantiated

使用AndroidStudio在寫佈局檔案預覽時出現下面情況:

 Rendering Problems The following classes could not be instantiated:
- android.support.v7.app.WindowDecorActionBar (Open Class, Show Exception, Clear Cache)
 Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE.  If this is an unexpected error you can also try to build the project, then manually refresh the layout.  Exception Details java.lang.NullPointerException   at android.support.v7.app.WindowDecorActionBar.getDecorToolbar(WindowDecorActionBar.java:246)   at android.support.v7.app.WindowDecorActionBar.init(WindowDecorActionBar.java:202)   at android.support.v7.app.WindowDecorActionBar.<init>(WindowDecorActionBar.java:194)   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)   at com.android.layoutlib.bridge.bars.AppCompatActionBar.<init>(AppCompatActionBar.java:89)   at com.android.layoutlib.bridge.impl.Layout.createActionBar(Layout.java:238)   at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:150) Copy stack to clipboard   Failed to find the style corresponding to the id 2130772069 (22 similar errors not shown)  Failed to load AppCompat ActionBar with unknown error. (3 similar errors not shown)  Tip: Try to refresh the layout. 

出現這種情況,修改下style,然後clean一下,如果還是不行再invalidate cache/restart。


將parent修改如下新增一個Base屬性:


操作了之後再進行預覽看看。