在下面的行中抛出错误
setContentView(R.layout.activity_main);
android.view.InflateException:二进制XML文件行#9:错误膨胀类android.support.v7.app.widget.RecycleView
我错过了什么?
代码
MainActivity.java
package com.example.xxx.yyyy;
import android.database.sqlite.SQLiteException;
//import android.support.v7.app.AlertController;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private final static String TAG = "MainActivity";
DBHandler dbHandler = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
activity_main.xml中
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.app.widget.RecycleView
android:id="@+id/esp_menu"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.app.widget.RecycleView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
答案 0 :(得分:2)
xml中的错误。 RecycleView而不是RecyclerView(丢失了Recycler末尾的r字母)