尝试从资源中加载Drawable。获得此追溯和崩溃:
protected void GetItemList()
{
using (SqlCommand cmd = new SqlCommand("select ID, Group from TableGroup order by Group"))
{
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
conn.Open();
cboGroup.DataSource = cmd.ExecuteReader();
cboGroup.DataTextField = "Group";
cboGroup.DataValueField = "ID";
cboGroup.DataBind();
conn.Close();
}
}
我试图按照修复加载: Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml
答案 0 :(得分:0)
您应该添加setCompatVectorFromResourcesEnabled
。
启用后,AppCompat可以截取一些可绘制的通货膨胀 框架,它可以实现内部矢量抽象的隐式膨胀 DrawableContainer资源。
public MyOtherDbContext : DbContext
{
public DbSet<ExtendePerson> ExtendedPersons {get; set;}
public DbSet<Grade> Grades {get; set;}
public DbSet<Hobby> Hobbies {get; set;}
public override void OnModelCreating(...)
{
// every extended person has zero or more Grades
// every Grade belongs to exactly one Person
// using foreign key PersonId
modelBuilder.Entity<ExtendedPerson>()
.HasMany(extendedPerson => extendedPerson.Grades)
.WithRequired(grade => grade.Person)
.HasForeignKey(grade => grade.PersonId);
// every extended person has zero or more hobbies
// every hobby belongs to exactly one ExtendedPerson
// using foreign key ExtendedPersonId
modelBuilder.Entity<ExtendedPerson>()
.HasMany(extendedPerson => extendedPerson.Hobbies)
.WithRequired(hobby => hobby.ExtendedPerson)
.HasForeignKey(hobby => hobby.ExtendedPersonId);
// proper table name for hobbies:
modelBuilder.Entity<Hobby>().ToTable("Hobbies");
}
}
<强> FYI 强>
@Override
protected void onCreate(Bundle savedInstanceState) {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_name);
当找不到请求的资源时,资源API会抛出此异常。查看您当地的 Resources$NotFoundException:File res/drawable-v22/ic_group_tip_1.xml
部分。