繁体   English   中英

Android Studio预览未正确显示RecyclerView和工具栏

[英]Android Studio Preview Not Showing RecyclerView and Toolbar Correctly

请找到屏幕截图 屏幕截图 我为此做了很多搜索。 我的android studio已更新为3.0.1。 这是我项目中的依赖项。 Studio 3.0.1是否存在问题?

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

这是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>

如果您的build.gradle文件中存在解析策略,则请按如下所示添加更新的依赖项

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'
        }
    }

在android Studio中,转到“文件”->“项目结构”->“依赖项”,然后单击绿色+符号并选择库依赖项。 在那里您可以搜索recyclerview并包含该依赖项,再次构建项目希望对您有所帮助

您需要将库更新为最新(接近最新)版本:

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'

并将您的compileSdkVersion更改为27(接近最新版本)

将这些依赖项添加到build.gradle文件中(不在项目级别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'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM