I am using from this style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox.Dense"
but get me bellow error:
Caused by: android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class com.google.android.material.textfield.TextInputLayout
Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.google.android.material.textfield.TextInputLayout
I added bellow implementation
but not work yet:
implementation("androidx.compose.material3:material3:1.0.0-alpha13")
implementation("androidx.compose.material3:material3-window-size-class:1.0.0-alpha13")
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.material:compose-theme-adapter-3:1.0.11'
And:
...
repositories {
google()
mavenCentral()
jcenter()
}
...
Here is my xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="38dp"
android:layout_marginEnd="38dp"
app:cardCornerRadius="25dp"
app:cardElevation="10dp"
app:cardUseCompatPadding="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:hint="Email or User Name"
app:boxStrokeColor="#4E4A4A"
app:boxStrokeWidth="1dp"
app:shapeAppearanceOverlay="@style/Button4">
<com.google.android.material.textfield.TextInputEditText
android:id="@ id/eMail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName|textEmailAddress"
android:textColor="@color/black"
android:textSize="13sp"
android:textStyle="normal" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:hint="Password"
app:boxStrokeColor="#4E4A4A"
app:boxStrokeWidth="1dp"
app:endIconMode="password_toggle"
app:shapeAppearanceOverlay="@style/Button4">
<com.google.android.material.textfield.TextInputEditText
android:id="@ id/passwords"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword"
android:textColor="@color/black"
android:textSize="13sp"
android:textStyle="normal" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@ id/signIn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:elevation="15dp"
android:gravity="center"
android:text="Log In"
android:textAllCaps="false"
android:textSize="17sp"
app:shapeAppearanceOverlay="@style/Button5" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
CodePudding user response:
Don't forget to use Theme.Material3 in your application
AndroidManifest.xml
<application
android:theme="@style/AppTheme" //ADD your parent Theme here
...
/>
style.xml
<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar"> //Change parent theme as per your requirement after Material3