Android TextInputEditText, inputType = textPassword, я не вижу точек - PullRequest
0 голосов
/ 03 мая 2018

Я использую TextInputEditText в своей деятельности. Я установил inputType 'textPassword'. Но я не вижу точек для защиты введенного мной пароля.

Это мои исходные коды просмотра.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">

    <ImageView
        android:id="@+id/email_login_background_img"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:src="@drawable/intro_background" />

    <ImageView
        android:id="@+id/email_login_logo_img"
        android:layout_width="240dp"
        android:layout_height="32dp"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="24dp"
        android:scaleType="centerCrop"
        android:src="@drawable/rock_bottom_logo" />

    <android.support.design.widget.TextInputLayout
        android:id="@+id/email_login_email_layout"
        style="@style/EmailTextInputEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/email_login_logo_img"
        android:layout_marginBottom="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/email_login_email_txt"
            style="@style/EmailTextInputEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/email_login_email_txt"
            android:inputType="textEmailAddress" />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/email_login_password_layout"
        style="@style/EmailTextInputEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/email_login_email_layout"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        app:passwordToggleEnabled="true"
        app:passwordToggleTint="@color/colorAccent">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/email_login_password_txt"
            style="@style/EmailTextInputEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/email_login_password_txt"
            android:inputType="textPassword" />
    </android.support.design.widget.TextInputLayout>


    <Button
        android:id="@+id/email_login_sign_in_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/email_login_password_layout"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="8dp"
        android:background="@drawable/button_custom_login"
        android:text="@string/email_login_sign_in_txt"
        android:textColor="@color/white" />

    <TextView
        android:id="@+id/email_login_sign_up_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/email_login_sign_in_btn"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="48dp"
        android:gravity="center"
        android:text="@string/email_login_sign_up_txt"
        android:textColor="@color/white"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/email_login_password_find_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/email_login_sign_up_btn"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="48dp"
        android:gravity="center"
        android:text="@string/email_login_sign_up_txt"
        android:textColor="@color/white"
        android:textSize="16sp" />

</RelativeLayout>

И это скриншот, который показывает мою проблему.

enter image description here

Может выглядеть не очень хорошо, но точка определенно не видна вообще.

И это стиль, который применяется к моей деятельности.

<style name="AppTheme2" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="colorControlActivated">@color/colorPrimary</item>
        <item name="colorControlNormal">@color/colorDarkerGray</item>
    </style>

Как я могу решить эту проблему. Мне нужна ваша помощь. Спасибо.

Кроме того, это мой стиль EmailTextInputEditText.

<style name="EmailTextInputEditText" parent="TextAppearance.AppCompat">
    <item name="android:textColor">@color/white</item>
    <item name="android:textColorHint">@color/white</item>
    <item name="colorControlNormal">#a90000</item>
    <item name="android:textCheckMark">@color/white</item>
</style>

Дополнительно, это мой color.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">@android:color/holo_red_dark</color>
    <color name="colorPrimaryDark">#c20000</color>
    <color name="colorPrimaryLight">#ea0000</color>
    <color name="colorAccent">@android:color/white</color>
    <color name="colorBlack">@android:color/black</color>
    <color name="colorVideoTxt">#001020</color>
    <color name="colorVideoTransparent">#92dadada</color>
    <color name="colorDarkerGray">@android:color/darker_gray</color>
    <color name="white">@android:color/white</color>
    <color name="cardBackground">#73e2e2e2</color>
    <color name="transparent">#00ffffff</color>

</resources>

Ответы [ 2 ]

0 голосов
/ 03 мая 2018

Проблема с вашей темой, попробуйте следующий код

Попробуйте это

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:src="@drawable/goku" />


    <ImageView
        android:id="@+id/email_login_logo_img"
        android:layout_width="240dp"
        android:layout_height="32dp"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="24dp"
        android:scaleType="centerCrop"
        android:src="@color/colorPrimary" />

    <android.support.design.widget.TextInputLayout
        android:id="@+id/email_login_email_layout"
        style="@style/EmailTextInputEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/email_login_logo_img"
        android:layout_marginBottom="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/email_login_email_txt"
            style="@style/EmailTextInputEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="email_login_email_txt"
            android:inputType="textEmailAddress" />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/email_login_password_layout"
        style="@style/EmailTextInputEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/email_login_email_layout"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        app:passwordToggleEnabled="true"
        app:passwordToggleTint="@color/colorAccent">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/email_login_password_txt"
            style="@style/EmailTextInputEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="email_login_password_txt"
            android:text="123456"
            android:inputType="textPassword" />
    </android.support.design.widget.TextInputLayout>


    <Button
        android:id="@+id/email_login_sign_in_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/email_login_password_layout"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="8dp"
        android:background="@color/colorPrimary"
        android:text="email_login_sign_in_txt"
        android:textColor="#FFFFFF" />

    <TextView
        android:id="@+id/email_login_sign_up_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/email_login_sign_in_btn"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="48dp"
        android:gravity="center"
        android:text="email_login_sign_up_txt"
        android:textColor="#FFFFFF"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/email_login_password_find_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/email_login_sign_up_btn"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="48dp"
        android:gravity="center"
        android:text="email_login_sign_up_txt"
        android:textColor="#FFFFFF"
        android:textSize="16sp" />

</RelativeLayout>

ТЕМА

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="colorControlActivated">@color/colorPrimary</item>
        <item name="colorControlNormal">#787777</item>
    </style>

    <style name="EmailTextInputEditText" parent="TextAppearance.AppCompat">
        <item name="android:textColor">@color/white</item>
        <item name="android:textColorHint">@color/white</item>
        <item name="colorControlNormal">#a90000</item>
        <item name="android:textCheckMark">@color/white</item>
    </style>

РЕЗУЛЬТАТ ИСПОЛЬЗОВАНИЯ С IMAGEVIEW

enter image description here

ПРИМЕЧАНИЕ : также не нужно дополнительно imageView удалить его и просто установить фон на RelativeLayout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    android:background="@drawable/goku">


    <ImageView
        android:id="@+id/email_login_logo_img"
        android:layout_width="240dp"
        android:layout_height="32dp"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="24dp"
        android:scaleType="centerCrop"
        android:src="@color/colorPrimary" />

    <android.support.design.widget.TextInputLayout
        android:id="@+id/email_login_email_layout"
        style="@style/EmailTextInputEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/email_login_logo_img"
        android:layout_marginBottom="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/email_login_email_txt"
            style="@style/EmailTextInputEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="email_login_email_txt"
            android:inputType="textEmailAddress" />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/email_login_password_layout"
        style="@style/EmailTextInputEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/email_login_email_layout"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        app:passwordToggleEnabled="true"
        app:passwordToggleTint="@color/colorAccent">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/email_login_password_txt"
            style="@style/EmailTextInputEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="email_login_password_txt"
            android:text="123456"
            android:inputType="textPassword" />
    </android.support.design.widget.TextInputLayout>


    <Button
        android:id="@+id/email_login_sign_in_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/email_login_password_layout"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="8dp"
        android:background="@color/colorPrimary"
        android:text="email_login_sign_in_txt"
        android:textColor="#FFFFFF" />

    <TextView
        android:id="@+id/email_login_sign_up_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/email_login_sign_in_btn"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="48dp"
        android:gravity="center"
        android:text="email_login_sign_up_txt"
        android:textColor="#FFFFFF"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/email_login_password_find_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/email_login_sign_up_btn"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="48dp"
        android:gravity="center"
        android:text="email_login_sign_up_txt"
        android:textColor="#FFFFFF"
        android:textSize="16sp" />

</RelativeLayout>

РЕЗУЛЬТАТ ИСПОЛЬЗОВАНИЯ БЕЗ ИЗОБРАЖЕНИЯ

enter image description here

0 голосов
/ 03 мая 2018

Попробуйте это -

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="10dp"
    android:gravity="center"
    android:backgroundTint="@color/background"
    android:textColorHint="@color/background">

    <EditText
        android:id="@+id/edtxtUsrID"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Email ID"
        android:inputType="text"
        android:maxLength="30"
        android:backgroundTint="@color/view_grey"
        android:maxLines="1"/>

</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="10dp"
    android:layout_marginTop="5dp"
    android:backgroundTint="@color/view_grey"
    android:textColorHint="@color/view_grey">

    <EditText
        android:id="@+id/edtxtUsrPswrd"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Password"
        android:inputType="textPassword"
        android:maxLength="30"
        android:maxLines="1"
        android:backgroundTint="@color/view_grey"
        android:textColorHint="@color/view_grey" />

</android.support.design.widget.TextInputLayout>

@ Junburg Вы добавили - style = "@ style / EmailTextInputEditText" в TextInputEditText удалите эту строку из TextInputEditText, см. Скриншот ниже enter image description here

...