Separately registered class MyView :
public class MyView extends View { public MyView(Context context) { super(context); } public MyView(Context context, AttributeSet attrs) { super(context, attrs); } public MyView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public void onDraw(Canvas canvas) { canvas.drawColor(Color.RED); } } and added to layout :
<MyView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/view" android:layout_gravity="center_vertical"/> As a result of the launch, the exception crashes:
android.view.InflateException: Binary XML file line # 7: Error inflating class MyView
Help solve the problem, and explain what my mistake is.
<com.example.MyView>. Hyde - pavlofff