Ошибка при создании пользовательского представления - PullRequest
3 голосов
/ 02 декабря 2011

У меня есть customview, я хочу добавить, что в xml-файле я пробовал вот так, но я получаю эту ошибку

  Custom view TouchImageView is not using the 2- or 3-argument View constructors;
  XML attributes will not work

это XML, который я использую ..

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

 <view 
   class="com.zoom.TouchImageView"
   android:id="@+id/webView1"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent" />

</LinearLayout>

1 Ответ

16 голосов
/ 02 декабря 2011

Добавьте конструктор:

public TouchImageView(Context context, AttributeSet attributeSet)
{
    super(context, attributeSet);

    //TODO:
}

в пользовательский класс просмотра.

...