在使用约束前,比如insert前看看调用db.execSQL("PRAGMA foreign_keys = ON;");enable foreign key功能,因为默认是关闭的。 SQLite文档:https://www.sqlite.org/foreignkeys.html