0

我收到以下错误:

android.view.InflateException: Binary XML file line #8: Class is not a View com.abcxyzradio.ActionsRow

布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/wholeView"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.abcxyzradio.ActionsRow
        android:id="@+id/actions_row_actions"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</LinearLayout>

代码:

@Override
protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
    View v = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.now_playing_channel_row, parent, false);
    ViewHolder vh = new ViewHolder(v);

    return vh;
}

ActionsRow 从 Row 类扩展而来。可能缺少什么,有什么想法吗?

4

1 回答 1

1

如果您所说的“行类”是指此类Row则它不是小部件,尽管它位于widget名称中的 Java 包中。Row继承自Object, not View,因此您不能在布局中使用它。

于 2015-03-06T18:33:41.690 回答