标签: android-textinputlayout

密码切换图标 textinputlayout 覆盖错误图标

我正在使用密码切换来显示和隐藏密码。而且我不想使用自定义 drawable。但是,当此编辑文本生成错误时,它会覆盖切换密码图标,并且无法向该图标添加填充或边距。如果对此有任何解决方案,那将是一种乐趣。这是我正在使用的代码:

       <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:textColorHint="@color/white"
                app:passwordToggleEnabled="true"
                app:passwordToggleTint="@color/white">

                <EditText
                    android:id="@+id/et_password"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:backgroundTint="@color/white"
                    android:hint="@string/password"
                    android:imeOptions="actionDone"
                    android:inputType="textPassword"
                    android:maxLength="40"
                    android:maxLines="1"
                    android:textColor="@color/white"
                    android:textColorHint="@color/app_green_color" />

            </com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

android android-textinputlayout android-textinputedittext material-components material-components-android

1
推荐指数
2
解决办法
2988
查看次数

如何在不使用库的情况下在状态、聚焦和正常状态下应用 TextInputLayout 的自定义形状

我想设计一个自定义圆角 TextInputLayout 正如我展示的活动 TextInputLayout 的示例图像在此输入图像描述以下

我的 xml 代码是

<com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.google.android.material.textfield.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/mobile_number"
                android:inputType="number"
                android:fontFamily="@font/montserrat_regular"
                android:maxLength="10" />
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

它给我一个默认的 TextInputLayout。我怎样才能得到我的观点。请帮助我。样式声明中出现错误。 样式声明错误

android widget android-textinputlayout material-components material-components-android

1
推荐指数
1
解决办法
2281
查看次数

在 Android 中的眼睛图标上显示和隐藏密码

在这里我正在创建登录屏幕,我必须在其中输入用户名和密码,在密码字段中我设置了眼睛图标。当输入密码时,密码将被隐藏,单击眼睛图标后,它应该显示真实的字符。我已经提到了我的 XML 和 java 代码。请查看并帮助我解决方案。我需要在 gradle 中添加任何内容吗?请建议。谢谢

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    tools:context="com.tecnotree.selfcare.ui.login.LoginActivity">

    <VideoView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:visibility="gone"
        android:id="@+id/background_video_view"
        />
    <!-- Login progress -->

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:contentDescription="@string/tecnotree_selfcare"
        android:src="@drawable/login_background"
        android:scaleType="centerCrop"/>

    <ProgressBar
        android:id="@+id/login_progress"
        style="?android:attr/progressBarStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:visibility="gone" />

    <ScrollView
        android:id="@+id/login_form"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:id="@+id/email_login_form"
            android:layout_width="match_parent"
            android:padding="@dimen/paddingLarge"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="0dp"
                android:layout_marginRight="0dp"
                android:background="@drawable/sc_card_rounded_login"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="@dimen/marginLarge"
                    android:layout_marginBottom="@dimen/marginLarge"
                    android:contentDescription="@string/tecnotree_selfcare"
                    android:src="@drawable/logo" />

                <TextView
                    style="@style/AppTheme.TextWhiteLargeBold"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Simple, Secure …
Run Code Online (Sandbox Code Playgroud)

android android-edittext kotlin android-textinputlayout material-components

1
推荐指数
1
解决办法
9819
查看次数

如何在每个 TextInputEditText 上单击 drawableRight

在此处输入图片说明

如何单击每个 TextInputEditText 的 drawableRight 编辑图像?我想单击编辑图标,然后启用编辑每个字段。我怎样才能做到这一点?

 <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <!--First name-->

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="@dimen/_64dp">

                <com.google.android.material.textfield.TextInputEditText
                   
                    android:id="@+id/etFirstName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:focusableInTouchMode="true"
                    android:drawableRight="@drawable/icon_edit"
                    android:hint="@string/label_fname"
                    android:inputType="textCapWords" />
            </com.google.android.material.textfield.TextInputLayout>

            <!--Middle name-->
            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/activity_registration_tiMiddleName"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_64dp">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/etMiddleName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:focusableInTouchMode="true"
                    android:drawableRight="@drawable/icon_edit"
                    android:hint="@string/label_mname"
                    android:inputType="textCapWords"/>

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


     </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

那么如何使用 drawbleRight 单独编辑每个字段。请帮忙。

android onclicklistener android-textinputlayout android-textinputedittext material-components-android

1
推荐指数
1
解决办法
288
查看次数

将样式应用到 TextInputLayout 时应用程序崩溃

当我在 TextInputLayout 中使用样式时,出现以下错误。我怎样才能解决这个问题?

引起原因:java.lang.IllegalArgumentException:此组件上的样式要求您的应用程序主题为 Theme.MaterialComponents(或其后代)。

<com.google.android.material.textfield.TextInputLayout
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:boxStrokeColor="#ffcc00"
        android:theme="@style/EditTextTheme"
        app:layout_constraintEnd_toStartOf="@id/guidelineEnd"
        app:layout_constraintStart_toStartOf="@id/guidelineStart"
        app:layout_constraintTop_toTopOf="parent">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:lines="1" />

    </com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

应用此解决了问题,但在 TextInputLayout 中未实现轮廓边框

样式.xml

<style name="EditTextTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
Run Code Online (Sandbox Code Playgroud)

android android-textinputlayout

1
推荐指数
1
解决办法
1031
查看次数

Android TextInputLayout 和 TextInputEditText 光标颜色问题

在此处输入图片说明问题

我有这个问题,在xxx是紫色的光标后,我想知道那个放置光标的名称,我想更改颜色以匹配我的主题。我阅读了许多论坛和文档,唯一找到的是 cursorDrawable,但事实并非如此。请帮我搜索正确的名称或解决方案。谢谢 PD:那东西的紫罗兰色不是我的风格或颜色。

android android-theme android-styles android-textinputlayout material-components-android

1
推荐指数
1
解决办法
946
查看次数

TextInputEditText未显示drawableRight图标

我使用下面的代码来显示用户名输入.EditText工作正常但右侧显示图标不可见.

<android.support.design.widget.TextInputLayout
        android:id="@+id/login_screen_edit_text_username_wrapper"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <android.support.design.widget.TextInputEditText
            android:id="@+id/login_screen_edit_text_username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/label_username"
            android:inputType="text"
            android:drawableRight="@mipmap/email_icon"
            android:text="abcd@gmail.com"
            />
    </android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

我在Nexus6p android 6.0版上测试此代码.父布局是LinearLayout.如果任何人面临同样的问题并且得到修复,请更新.

android android-edittext android-textinputlayout

0
推荐指数
1
解决办法
4688
查看次数

如何停止 textinputlayout 以更改 endIcondrawable 的颜色并仅在用户单击时更改下划线的颜色?

问题 1: TextInputLayout 正在更改 endIconDrawable 的颜色,默认情况下它是绿色和白色,但它正在更改为灰色,那么我该如何阻止它?

问题 2:我只想在用户单击 TextInputLayout 并开始输入时更改 backgroundtint 或下划线颜色,因此如何操作。

代码:

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/d"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/_10sdp"
            app:endIconMode="custom"
            app:endIconDrawable="@drawable/green"
            app:endIconContentDescription="@string/D"
            android:hint="@string/D">
            <com.google.android.material.textfield.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                />
        </com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

android material-design android-textinputlayout android-textinputedittext

0
推荐指数
1
解决办法
1046
查看次数