android:inputType在添加书法后不起作用

时间:2018-08-15 04:41:17

标签: android calligraphy

在将书法添加到字体后,密码变得模糊并且无法查看。我已应用val title1 by lazy { include1.title } val description1 by lazy { include1.description } val title2 by lazy { include2.title } val description2 by lazy { include2.description } ,但仍然相同。我正在使用的书法是
 android:fontFamily="sans-serif",而我的implementation uk.co.chrisjenx:calligraphy:2.3.0是21,图书馆是sdkVersion

signin.xml

com.android.support:appcompat-v7:27.1.1

SignIn.java

<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_borenos"
tools:context="com.example.liew.idelivery.SignIn">


<LinearLayout
    android:orientation="vertical"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_centerInParent="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <com.rengwuxian.materialedittext.MaterialEditText
        android:id="@+id/edtPhone"
        android:hint="Phone Number"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColorHint="@android:color/white"
        android:text="0128688032"
        android:textColor="@android:color/white"
        android:textSize="34sp"
        android:inputType="phone"
        app:met_baseColor="@android:color/white"
        app:met_floatingLabel="highlight"
        app:met_maxCharacters="12"
        app:met_primaryColor="@android:color/white"
        app:met_singleLineEllipsis="true"
        />

    <com.rengwuxian.materialedittext.MaterialEditText
        android:id="@+id/edtPassword"
        android:hint="Password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColorHint="@android:color/white"
        android:text="chau95"
        android:fontFamily="sans-serif"
        android:textColor="@android:color/white"
        android:textSize="34sp"
        android:inputType="textPassword"
        app:met_baseColor="@android:color/white"
        app:met_floatingLabel="highlight"
        app:met_maxCharacters="12"
        app:met_primaryColor="@android:color/white"
        app:passwordToggleEnabled="true"

        />

   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:orientation="horizontal"
       android:weightSum="2">

       <com.rey.material.widget.CheckBox
           android:id="@+id/ckbRemember"
           android:layout_width="0dp"
           android:layout_weight="1"
           android:layout_height="wrap_content"
           android:text="Remember me"
           android:textColor="@android:color/white"
           app:cbd_strokeColor="@android:color/white"
           app:cbd_tickColor="@android:color/black"
           style="@style/Material.Drawable.CheckBox"
           android:gravity="center_vertical"/>

       <TextView
           android:layout_width="0dp"
           android:layout_height="wrap_content"
           android:layout_weight="1"
           android:textColor="@android:color/white"
           android:id="@+id/txtForgotPwd"
           android:text="@string/forgot_pwd"/>

   </LinearLayout>

</LinearLayout>

<info.hoang8f.widget.FButton
    android:id="@+id/btnSignIn"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_alignParentBottom="true"
    android:text="Sign In"
    android:textColor="@android:color/white"
    app:fButtonColor="@color/btnSignUp"
    app:cornerRadius="4dp"
    app:shadowColor="@android:color/black"
    app:shadowEnabled="true"
    app:shadowHeight="5dp" />


</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

  EditTextPassword.setInputType(InputType.TYPE_CLASS_TEXT |
            InputType.TYPE_TEXT_VARIATION_PASSWORD);