问题
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