1

I have these two TextInputLayout and I want to change colors.

Customzing this two TextInputLayout in android

I want to change color Accent to color Violet (like two violet lines).

and how to change cursor color ??

and this is my XML code:

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/amount_lyt"
    android:layout_width="0.0dp"
    android:layout_height="0.0dp"
    android:layout_margin="10.0dp"
    app:layout_constraintBottom_toTopOf="@+id/guideline61"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/guideline60">

    <ir.jetservice.customviews.AVEditText
        android:id="@+id/amount"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="@string/amount"
        android:text="10,000"
        android:textSize="15.0sp"
        android:textStyle="normal" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/account_lyt"
    android:layout_width="0.0dp"
    android:layout_height="0.0dp"
    android:layout_margin="10.0dp"
    app:layout_constraintBottom_toTopOf="@+id/guideline62"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/guideline61">

    <ir.jetservice.customviews.AVEditText
        android:id="@+id/account"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="@string/account_number"
        android:textSize="15.0sp"
        android:textStyle="normal" />

</com.google.android.material.textfield.TextInputLayout>

Note: AVEditText is a normal EditText, it just changes English numbers to Persian.

Shahrad Elahi
  • 774
  • 12
  • 22

2 Answers2

1

You need to change the colors located in res/values/styles

<item name="colorPrimaryDark">#49C0D8</item>
Hadi Haidar
  • 337
  • 2
  • 13
0

If you're changing the Cursor color then see this solution: Change EditText Cursor color

For changing it's line color you've to add theme in styles.xml and appply that theme to the EditText.

Add theme in styles :

<style name="Theme.App.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorControlNormal">#c5c5c5</item>
    <item name="colorControlActivated">@color/yourColor</item>
    <item name="colorControlHighlight">@color/yourColor</item>
</style>

Apply theme to the EditText :

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/amount_lyt"
    android:layout_width="0.0dp"
    android:layout_height="0.0dp"
    android:layout_margin="10.0dp"
    app:layout_constraintBottom_toTopOf="@+id/guideline61"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/guideline60">

    <ir.jetservice.customviews.AVEditText
        android:id="@+id/amount"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="@string/amount"
        android:text="10,000"
        android:textColor="@color/yourColor"
        android:textCursorDrawable="@null"
        android:theme="@style/Theme.App.Base"
        android:textSize="15.0sp"
        android:textStyle="normal" />

</com.google.android.material.textfield.TextInputLayout>
Modi Harsh
  • 555
  • 4
  • 7