Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

android.support.design.widget.TextInputEditText #205

Closed
abond opened this issue Jun 10, 2016 · 6 comments
Closed

android.support.design.widget.TextInputEditText #205

abond opened this issue Jun 10, 2016 · 6 comments

Comments

@abond
Copy link
Contributor

abond commented Jun 10, 2016

Hello!

Please, add this widget to your DSL.

Thanks!

@yaymalaga
Copy link

yaymalaga commented Aug 30, 2016

Now, with the new com.android.support:design:24.2.0 library, apps force close: java.lang.ClassCastException: android.widget.EditText cannot be cast to android.support.design.widget.TextInputEditText

Any workaround to use before TextInputEditText is added in anko @yanex ?

@abond
Copy link
Contributor Author

abond commented Aug 31, 2016

Define this somewhere:

inline fun ViewManager.textInputEditText() = textInputEditText {}
inline fun ViewManager.textInputEditText(theme: Int = 0, init: TextInputEditText.() -> Unit) = ankoView({ TextInputEditText(it) }, theme, init)

and you'll be able to write this:

textInputLayout {
    textInputEditText {
        ...
    }
 }

@yaymalaga
Copy link

yaymalaga commented Aug 31, 2016

@abond working perfectly, thanks for the help!

@Rahulkr2
Copy link

@abond Could you please elaborate ? Why does this work ?

@abond
Copy link
Contributor Author

abond commented Jul 11, 2017

@Rahulkr2 The principles of building DSL's in Kotlin well described in this article https://kotlinlang.org/docs/reference/type-safe-builders.html.
Reading it should help you understand how Anko DSL works.

@4u7 4u7 modified the milestones: Anko 0.10.2, Anko 0.10.3 Nov 10, 2017
@megifernanda
Copy link

how to make XML android.support.design.widget.TextInputEditText in kotlin?

@4u7 4u7 closed this as completed in 6bc217c Nov 15, 2017
CrackerCat pushed a commit to CrackerCat/anko that referenced this issue Jul 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants