我收到以下错误:
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;
}
Actions Row从Row类扩展。什么可能缺少,任何想法?
答案 0 :(得分:1)
如果“行类”是指this Row
class,那么它不是小部件,尽管名称中包含widget
的Java包。 Row
继承自Object
,而不是View
,因此您无法在布局中使用它。