Created
November 18, 2020 11:29
-
-
Save Jeevuz/c80bdad7c21c43e62c1c92e319823dd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.util.AttributeSet | |
import android.view.View | |
import androidx.core.content.withStyledAttributes | |
class MyCustomView( | |
context: Context, | |
attrs: AttributeSet? = null | |
) : View(context, attrs) { | |
init { | |
context.withStyledAttributes(attrs, R.styleable.MyCustomView) { | |
} | |
} | |
} | |
// Also set | |
// <declare-styleable name="MyCustomView"> | |
// <attr name="someAttribute" format="color"/> | |
// </declare-styleable> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment