Search code examples
androidpreviewcoordinator-layout

Coordinator layout is not displaying on preview


I have a coordinator layout in which i want to display a bottom sheet with nestedScrollView. But my coordinator layout is not working properly as it is not showing any preview.

This is the preview

xml file:

 <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".StartingActivity">


  <androidx.core.widget.NestedScrollView
      android:layout_width="match_parent"
      android:layout_height="250dp"
      android:background="@drawable/gradiantbackground2">

  </androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

gradle file dependency:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.android.support:design:29.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'devs.mulham.horizontalcalendar:horizontalcalendar:1.1.7'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.legacy:legacy-support-v13:1.0.0'
    implementation 'com.jjoe64:graphview:4.2.2'
    implementation 'com.google.android.material:material:1.1.0-alpha09'

}

Solution

  • Try rebuild/restart Android Studio if there is no error shown.