Open mvysny opened 7 years ago
++ on this, this is really important for interop in my opinion. It would be great if I could make my custom views extend _LinearLayout
, for example, so that I can access lparams
as I create them, but extending _LinearLayout
would make my view broken for XML inflation.
I guess, that when multiple receiver support in Kotlin will be implemented, these classes will go away.
For better interoperability with Android it would be great if Anko could provide the (Context, AttributeSet) constructor. The use-case is as follows: I would like to gradually convert parts of my UI to Anko, and inflating those parts as Views from the original UI XML. However, that's not possible because of missing constructor (Context, AttributeSet). If I don't override that constructor, Android will complain:
On the other hand, if I introduce just a dummy constructor
constructor(ctx: Context, attrs: AttributeSet?) : super(ctx)
then Android won't process even the android:id parameter, and this will result in NPE later on when findViewById won't find anything.