I'm trying to create a TextInputLayout with Outline Boarder. But whenever I use the,following style, it malfunction(crash) the app.
Before posting I have tried every solution that listed in and outside the stackoverflow, but nothing fixed the issue so far.
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
Current layout
<ScrollView...
<LinearLayout
android: layout_width = "200dp"
android: layout_height = "wrap_content"
android: orientation = "vertical"
android: layout_marginTop = "2dp" >
<com.google.android.material.textfield.TextInputLayout
android: id = "@+id/outlinedTextField"
android: layout_width = "match_parent"
android: layout_height = "wrap_content"
android: hint = "@string/label"
style = "@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app: boxStrokeWidthFocused = "2dp"
app: boxStrokeColor = "@color/border_primary" >
<com.google.android.material.textfield.TextInputEditText
android: layout_width = "match_parent"
android: layout_height = "wrap_content" />
</LinearLayout>
</ScrollView>
Complete Layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".user.userprofile.UserProfileFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/user_profile_header"/>
<LinearLayout
android:layout_width="200dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/outlinedTextField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android: hint = "@string/label"
app:hintTextColor="@color/text_primary"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:boxStrokeWidthFocused="2dp"
app:hintTextColor="@color/text_primary"
app:boxStrokeColor="@color/border_primary">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
More Info : when style is added hint goes out of focus. Also border doesn't appear.