本文介紹了singleLine 屬性的替代方案(已棄用)TextInputEditText的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我最近使用了 TextInputEditText
,我得到 singleLine
屬性 Deprecated
有沒有其他方法可以解決這個問題?
解決方案 android:singleLine
屬性自 API 級別 15.您可以使用 android:maxLines
實現相同的行為,它允許您指定任意數量的行.這優于 android:singleLine
,后者限制您只允許一行.
I recently used TextInputEditText
and I got lint error that singleLine
attribute is Deprecated
<android.support.design.widget.TextInputEditText
android:id="@+id/my_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/string_hint_dob"
android:lines="5"/>
</android.support.design.widget.TextInputLayout>
Getting strike-through as below:
Is there any alternative way for this?
解決方案 The android:singleLine
attribute has been deprecated since API Level 15. You can achieve the same behaviour by using android:maxLines
, which allows you to specify an arbitrary number of lines. This is superior to android:singleLine
, which restricts you to only allowing one line.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minLines="2"
android:maxLines="2" /> <!-- can specify arbitrary number of max lines -->
這篇關于singleLine 屬性的替代方案(已棄用)TextInputEditText的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!