我正在使用Android設計庫中的TextInputLayout在EditText上顯示標籤。TextInputLayout提示重疊問題
問題是,當我開始與EditText上提示(標籤)文本活動重疊的實際文本(一秒鐘),然後纔回到自己的位置(在EditText上的頂部)。
爲了說明這個問題,我記錄一個簡短的樣本視頻:https://youtu.be/gy0CzcYggxU
這裏是我的activity.xml:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="@+id/firstNameTextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/firstNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/first_name"
android:inputType="textCapWords"
android:textColor="@color/textPrimary"
android:textColorHint="@color/textSecondary"
android:textSize="16sp"
android:theme="@style/CustomEditText"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp">
<EditText
android:id="@+id/lastNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/last_name"
android:inputType="textCapWords"
android:textColor="@color/textPrimary"
android:textColorHint="@color/textSecondary"
android:textSize="16sp"
android:theme="@style/CustomEditText"/>
</android.support.design.widget.TextInputLayout>
我認爲這發生在你回到活動那些具有價值的editext? – Herry
@Herry是的,確切地說。那麼問題在哪裏? –
我不確定問題出在哪裏,但是當您回到活動時,首先由java代碼設置Editext值,然後通過java代碼設置提示並從xml文件中刪除提示僅從java代碼中使用它。 – Herry