user4746449
user4746449

Reputation: 133

RecyclerView Rendering Issue

I want to implement recycler view layout, but I am getting error "render problem". I tried to add include, but the error still exists. How can I solve the problem ?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:background="@color/viewBg"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.example.waadalkatheri.popularmovies.MainActivity"
    tools:showIn="@layout/activity_main"
    android:layout_marginTop="@dimen/activity_vertical_margin">
    <include layout="@layout/activity_main"/>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:scrollbars="vertical" />

</RelativeLayout>

image the error enter image description here

the error: I

nformation:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources]
/Users/mac/AndroidStudioProjects/popularMovies/app/src/main/res/layout/content_main.xml
Error:(2) No resource identifier found for attribute 'layout_behavior' in package 'com.example.waadalkatheri.popularmovies'
Error:(8, 26) No resource found that matches the given name (at 'layout_behavior' with value '@string/appbar_scrolling_view_behavior').
/Users/mac/AndroidStudioProjects/popularMovies/app/build/intermediates/res/merged/debug/layout/content_main.xml
Error:(2) No resource identifier found for attribute 'layout_behavior' in package 'com.example.waadalkatheri.popularmovies'
Error:(8, 26) No resource found that matches the given name (at 'layout_behavior' with value '@string/appbar_scrolling_view_behavior').
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

Upvotes: 0

Views: 1849

Answers (6)

Arnold Brown
Arnold Brown

Reputation: 1433

Try this

Just remove tools:showIn="@layout/activity_main" from your RelativeLayout

You can find the solution of render problem below the render error warning!!!

Upvotes: 0

lidkxx
lidkxx

Reputation: 2841

Firstly, since you are not using CoordinatorLayout, you can safely remove the problematic app:layout_behavior="@string/appbar_scrolling_view_behavior". Read more about it here: No resource identifier found for attribute 'layout_behavior' in package

Then, I think your android:showIn xml attribute is superfluous. Get rid of it. You are recursively referring to the same activity (with include and showIn) and that's what messes up your rendering.

Upvotes: 1

Sushrita
Sushrita

Reputation: 725

Add this to your app's build.gradle

dependencies{

         compile fileTree(include: ['*.jar'], dir: 'libs')

         compile 'com.android.support:recyclerview-v7:your_version'


       }

Upvotes: 0

sumit
sumit

Reputation: 1087

ok I think I found your problem.

Just change this one line in your xml:

tools:showIn="@layout/activity_main"  to tools:showIn="@layout/activity_main.xml"

Hope it helps!!!

Upvotes: 0

Cao Minh Vu
Cao Minh Vu

Reputation: 1948

Search all your project with keyword: "layout_behavior" and remove all lines of them. Especially, in "content_main.xml"

Upvotes: 0

hiashutoshsingh
hiashutoshsingh

Reputation: 1020

Remove this android:scrollbars="vertical" form your code and try rebuilding the project

Upvotes: 1

Related Questions