Created
January 18, 2020 12:41
-
-
Save krossovochkin/145ca7c5a696e25d78e5b26172765ecd to your computer and use it in GitHub Desktop.
Theme_1
This file contains hidden or 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
class MyLayoutInflater( | |
private val delegate: AppCompatDelegate | |
) : LayoutInflater.Factory2 { | |
override fun onCreateView( | |
parent: View?, | |
name: String, | |
context: Context, | |
attrs: AttributeSet | |
): View? { | |
return when (name) { | |
"TextView" -> MyTextView(context, attrs) | |
"LinearLayout" -> MyLinearLayout(context, attrs) | |
"Button" -> MyButton(context, attrs, R.attr.buttonStyle) | |
else -> delegate.createView(parent, name, context, attrs) | |
} | |
} | |
override fun onCreateView(name: String, context: Context, attrs: AttributeSet): View? { | |
return onCreateView(null, name, context, attrs) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment