Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Layout Preview showing blank screen with Coordinator layout in Android Studio 3.0

This is layout design code when i open layout preview page grey android screen showing only (android...CoordinatorLayout) and nothing showing on the screen.How can i solve this problem,i want to show the layout design in Layout Preview Screen.

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activity.AddDietActivity">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:gravity="center"
        app:popupTheme="@style/AppTheme.PopupOverlay"
        android:background="@drawable/menubar">

        <TextView
            android:id="@+id/tv_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textStyle="bold"
            android:textSize="18dp"/>

        <TextView
            android:id="@+id/submitBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_gravity="end"
            android:layout_margin="10dp"
            android:onClick="clickToAddDiet"
            android:text="Save"
            android:textSize="18sp"
            android:textColor="#fff"/>
    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_add_diet" />

like image 943
Abhijit Roy Avatar asked Nov 09 '17 21:11

Abhijit Roy


1 Answers

I was getting the same issue and after clicking on the info icon in the layout editor, I found out why:

enter image description here

Change the Theme in Editor to AppCompat or another theme that inherits it. Worked for me.

like image 108
Mateus Gondim Avatar answered Oct 01 '22 13:10

Mateus Gondim