android - 在 android studio 中自定义 TextInputLayout 和 EditText

标签 android xml

我有这两个 TextInputLayout,我想改变颜色。

Customzing this two TextInputLayout in android

我想将color Accent 更改为color Violet(如两条紫色线条)。

以及如何更改光标颜色??

这是我的 XML 代码:

<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.

最佳答案

您需要更改位于 res/values/styles 中的颜色

<item name="colorPrimaryDark">#49C0D8</item>

关于android - 在 android studio 中自定义 TextInputLayout 和 EditText,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59414320/

相关文章:

java - 如何获取OnClickListener中线性布局中包含的textview的名称?

XML 站点地图太大?

java - 从网络浏览器获取图像并在应用程序中进行编辑

java.lang.RuntimeException : Unable to start activity ComponentInfo Android Manifest 错误

java - 当到达最后一个文本时重复数组?

android - textViewResourceId 参数是否总是必要的?

java - 谷歌地图大标记点击时不准确

android - 带有和不带有 "+"的 Android 布局 XML 中的 ID

php - LIBXML_NOENT 有什么作用(为什么不叫 LIBXML_ENT)?

python - 读取 XML 头编码