今天我试着使用新的Android RecyclerView。我创建了一个空白的项目,并将以下内容添加到它的布局中:
在gradle构建依赖项中,我已经添加了以下内容:
但是activity_main.xml的渲染仍然显示以下错误:
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
在gradle构建依赖项中,我已经添加了以下内容:
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.android.support:cardview-v7:21.+'
但是activity_main.xml的渲染仍然显示以下错误:
Rendering Problems The following classes could not be instantiated:
- android.support.v7.widget.RecyclerView (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.UnsupportedOperationException: Unsupported Service: accessibility at com.android.layoutlib.bridge.android.BridgeContext.getSystemService(BridgeContext.java:465
我在网络上找不到自己的解决方案,因为每个人都说“在您的gradle构建中实现以下依赖项:...”,而我已经添加了。
有人能提供一个解决方案吗?
问候 Tak3r07
编辑: onCreate:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}