扩充类错误(horizo​​ntalListView)

时间:2014-12-16 16:58:58

标签: android listview layout

我正在尝试使用水平视图,但是我收到此错误: android.view.InflateException:二进制XML文件行#39:错误输出类com.devsmart.android.ui.Horizo​​ntialListView

这是给我错误的方法:

public ProfileAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

    View v = LayoutInflater.from(parent.getContext())      //this line exactly
            .inflate(R.layout.card_layout, parent, false);



    ViewHolder vh = new ViewHolder(v);
    return vh;
}



XML Layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:widget="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >

    <android.support.v7.widget.CardView
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card_view"
        android:layout_gravity="center_horizontal"
        android:layout_width="match_parent"
        android:layout_height="90dp"
        card_view:cardCornerRadius="4dp"
        card_view:contentPadding="0dp"
    >

        <TextView
            android:id="@+id/info_text"
            android:layout_width="wrap_content"
            android:layout_height="45dp"
            android:layout_marginLeft="20dp"
            android:width="234dp"
            android:textSize="28sp"
            android:layout_gravity="top"
        />



        <com.devsmart.android.ui.HorizontialListView
            android:id="@+id/active_settings"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#ddd"

            />


        <!-- This RelativeLayout makes the button easier to click -->
        <RelativeLayout
            android:id="@+id/button_setting_profile_layout"
            android:layout_width="78dp"
            android:layout_height="80dp"
            android:layout_gravity="center_vertical|right"
            android:clickable="true"
            >



        <Button
            android:id="@+id/button_setting_profile"
            android:gravity="center_vertical|end"
            android:layout_width="38dp"
            android:layout_height="38dp"
            android:background="@drawable/ic_settings_grey600_24dp"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true" />

        </RelativeLayout>
    </android.support.v7.widget.CardView>


</LinearLayout>

1 个答案:

答案 0 :(得分:-1)

查看card_layout.xml文件。可能存在IDE未检测到的语法错误。如果看起来没问题,请检查实现com.devsmart.android.ui.Horizo​​ntialListView的库是否在编译时包含在项目中。