Rendering problems Rendering exception: could not find layout resource

I had a problem creating a project in Android Studio 2.2

When I try to create an xml layout, I get the following error:

Rendering problems Rendering exception: Could not find layout resource

enter image description here

Here is my xml code snippet:

<ScrollView xmlns:android="schemas.android.com/apk/res/android"
     xmlns:app="schemas.android.com/apk/res-auto"
     xmlns:tools="schemas.android.com/tools"
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <RelativeLayout android:layout_width="match_parent" 
       android:layout_height="match_parent"> 
       <LinearLayout android:layout_width="match_parent" 
          android:layout_height="match_parent"                                     android:orientation="vertical"> 
        <include layout="@layout/app_bar" />...

How can i fix this?

+4
source share
1 answer

Android Studio 2.2 launches ConstraintLayout for a nested layout. Add ConstraintLayout as the main layout for app_bar.xml.

    <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

</android.support.constraint.ConstraintLayout>

Note. - Remember to add dependencies for ConstraintLayout.

compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha2'
-1
source

All Articles