我正在实现 etsy 在 github 上为 StaggeredGrid https://github.com/etsy/AndroidStaggeredGrid提供的库。我得到的错误是布局 activity_svg.xml 的 InflationException
<com.etsy.android.grid.StaggeredGridView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:item_margin="8dp"
app:column_count="@integer/grid_column_count" />
android.view.InflationException Binary XML File Line#3 Error inflating class com.etsy.android.grid.StaggeredGridView 根据之前与问题相关的答案,我检查了构造函数:
public StaggeredGridView(final Context context) {
this(context, null);
}
public StaggeredGridView(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public StaggeredGridView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
根据之前的回答,我还检查了文件是否在这个库中。那么 InflationException 还有什么问题呢?为什么班级没有膨胀?
如果您希望我添加更多代码部分,请发表评论。