Android studio 3.1 XML preview not showing for some XML layouts

后端 未结 15 824
时光取名叫无心
时光取名叫无心 2020-12-08 02:54

Some layouts are shown, some just have blank, gray frame. I can\'t seem to find a correlation between XML layouts that work and those that do not, there is a mixture of use

相关标签:
15条回答
  • 2020-12-08 03:33

    Carefully check your layout-file for any incompatibilities create a new layout and add one textview in that view and check whether it will be working fine or not, sometimes our layout contains error it shouldn't showing, please try this way once and switch to "Design".click "force refresh layout"

    0 讨论(0)
  • 2020-12-08 03:36

    I just realized this problem is from FloatingActionButton. Remove it and the preview works.

    0 讨论(0)
  • 2020-12-08 03:37

    Mine worked by changing custom tabs to the version 28.0.0 in my build.gradle app

    api 'com.android.support:appcompat-v7:28.0.0' api 'com.android.support:customtabs:28.0.0'

    0 讨论(0)
  • 2020-12-08 03:37

    No need to do anything else other than just changing your Layout to LinearLayout in Activity_main.xml

    0 讨论(0)
  • 2020-12-08 03:39

    I've tried pretty much everything from above and nothing worked for me. Then I've downgraded my compileSdkVersion and targetSdkVersion

    ---> compileSdkVersion 27

    ---> targetSdkVersion 27

    and then

    ---> implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' to

    ---> implementation 'com.android.support:appcompat-v7:27.1.1'

    0 讨论(0)
  • 2020-12-08 03:39

    for android 3.1.3 I solved it by changing the dependencies

    from

    implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
    

    to

    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    
    0 讨论(0)
提交回复
热议问题