问题
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