Ben
Ben

Reputation: 3804

Outlined TextField with AndroidX

I updated my project to androidx:

implementation 'androidx.appcompat:appcompat:1.0.0'

Now the OutlinedBox from this approach with MaterialComponents is causing my app to crash.

style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"

I could create the outline as a background with an editText background (this approach), but is there a way to do it with androidx and material components? Or perhaps I'm missing something else?

Upvotes: 0

Views: 546

Answers (1)

Son Huynh
Son Huynh

Reputation: 939

The style style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" is belonging to Material Components, you need to implement it by add this dependency: implementation 'com.google.android.material:material:1.1.0-alpha06'. And remember to inherit your app theme from Material Components too:

<style name="MyAppTheme" parent="Theme.MaterialComponents.Light.Bridge">
    <!-- ... -->
</style>

For more detail, you can read this guide

Upvotes: 1

Related Questions