Android Studio Preview Not Showing RecyclerView and Toolbar Correctly

孤者浪人 提交于 2020-03-25 22:35:20

问题


Please find the screenshots I searched lot for this. My android studio is updated with 3.0.1. Here are the dependencies in my project. Is the issue with studio 3.0.1?

compile 'com.android.support:appcompat-v7:23.4.+'
compile 'com.android.support:design:23.3.0'`

Here is the xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </android.support.v7.widget.RecyclerView>
</LinearLayout>

回答1:


If resolution Strategy is present in your build.gradle file then please add updated dependency as below

configurations.all {
        resolutionStrategy {
            force 'com.android.support:design:27.0.1'
            force 'com.android.support:support-v4:27.0.1'
            force 'com.android.support:appcompat-v7:27.0.1'
        }
    }



回答2:


In android Studio ,Go to File->Project Structure->Dependencies Then click on green + sign and choose library dependencies. There you can search recyclerview and include that dependency, Build your project again Hope this Helps




回答3:


Add these dependencies in your build.gradle file (Not in project level gradle).

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'



回答4:


you need to update libraries to last(nearly last) versions:

compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:support-v4:27.0.2'
compile 'com.android.support:design:27.0.2'

and change your compileSdkVersion to 27(nearly last version)



来源:https://stackoverflow.com/questions/48637586/android-studio-preview-not-showing-recyclerview-and-toolbar-correctly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!