0

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
Box Box Box Box
  • 5,094
  • 10
  • 49
  • 67
user4746449
  • 133
  • 1
  • 10

6 Answers6

1

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

hiashutoshsingh
  • 980
  • 2
  • 14
  • 41
1

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.

lidkxx
  • 2,731
  • 2
  • 25
  • 44
0

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

Cao Minh Vu
  • 1,900
  • 1
  • 16
  • 21
0

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!!!

sumit
  • 1,047
  • 1
  • 10
  • 15
  • Well, you don't really need to add .xml after specifying the @layout/something path. Android Studio will deduce the rest itself :) – lidkxx Jul 14 '17 at 08:07
0

Add this to your app's build.gradle

dependencies{

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

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


       }
Sushrita
  • 725
  • 10
  • 29
0

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!!!

Arnold Brown
  • 1,330
  • 13
  • 28