Error inflating class android.support.design.widget.TextInputLayout
after switching to AndroidX and enabling style/Widget.MaterialComponents.TextInputLayout.OutlinedBox
Hello friends,
today I switched my projects to Androidx (required for a new lib I need), and I get errors about my TextInputLayout
.
Please note that it compiles perfectly when I remove OulinedBox style, but I absolutely need it for this project.
Does anyone knows a way to make OulinedBox TextInputLayout style work with AndroidX ?
Thank you so much for your help and time.
<android.support.design.widget.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="60dp"
android:layout_marginTop="20dp"
app:boxStrokeColor="@color/gradient_begin_purple">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/login"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
I have encountered this problem. I tried all things that given from stackoverflow but unfortunately couldn't find any solution. At the end I found the points that i missed. (I assume that you put material design dependency in your build.gradle)
1)Your app them must be like followings(in values and values-21 folders)
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
2)set activity theme to AppTheme in your manifest.xml
<activity
android:name=".ui.activities.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
Add implementation "com.google.android.material:material:1.1.0-alpha02"
in place of support design library.
It is working perfectly for me after replacing above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With