Skip to content Skip to sidebar Skip to footer

How To Use Own View In Layout?

I created a class like this public final class MyView extends View { public MyView(Context context, AttributeSet attrs) { super(context, attrs); [...] }

Solution 1:

You should write it like:

<view class="com.hitziger.barcode.MyView"...

Solution 2:

in the layout.xml, use:

<View 
    android:class="com.hitziger.barcode.MyView"
    android:id="@+id/my_view"
...

istead of:

<com.hitziger.barcode.MyView
    android:id="@+id/my_view"

Post a Comment for "How To Use Own View In Layout?"