Skip to content

Instantly share code, notes, and snippets.

@robillo
Created August 6, 2017 18:06
Show Gist options
  • Save robillo/c5f7cc0ccfa3c04bfd26e0d2ee3052d6 to your computer and use it in GitHub Desktop.
Save robillo/c5f7cc0ccfa3c04bfd26e0d2ee3052d6 to your computer and use it in GitHub Desktop.
MyCustomView class extending View class, with constructor matching super
package com.robillo.customviewstutorial;
import android.content.Context;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by robinkamboj on 06/08/17.
*/
public class MyCustomView extends View{
public MyCustomView(Context context) {
super(context);
}
public MyCustomView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public MyCustomView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public MyCustomView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment