Android Studio 3.1.3 does not show layout desing preview

て烟熏妆下的殇ゞ 提交于 2021-01-28 04:43:44

问题


It has passed some time since the last time I have created a new project in android studio and today when I did it the android studio does not show anything from the layout preview. Its a blank window and says "nothing to show".

I already tried;

updated the sdks tools, cleaned the project and rebuild it, invalidated and restarted caches, theme changes, and still nothing.

Solution

now i am using mac.


回答1:


as my experience, switch to "Design".click "force refresh layout"




回答2:


Did you update classpath

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
    classpath 'com.google.gms:google-services:3.1.0'

}



回答3:


Try this way, switch to your Design/Text tab in layout editor. And check the preview window. Preview will be there.

I don't know how this works but I frequently using this hack when my preview isn't working since I upgraded to android studio 3.1.3.

PS: This hack only applies to empty preview (none of the elements or menu items or options or messages are visible in the preview pane).




回答4:


please replace

compileSdkVersion 28
buildToolsVersion '28.0.0'
targetSdkVersion 28
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'

with

compileSdkVersion 27
buildToolsVersion '27.0.3'
targetSdkVersion 27
implementation 'com.android.support:appcompat-v7:27.1.1'



回答5:


screenshoot

click on the Eye icon in the selected area, in the pop-up window enable Show Layout Decorations.

If the magnet next to the eye icon is active, make it inactive.

Have a nice day.



来源:https://stackoverflow.com/questions/50792203/android-studio-3-1-3-does-not-show-layout-desing-preview

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