Android開發:設置文本輸入框是否可編輯


Android開發在layout配置文件中添加一個EditText:

1 <EditText 
2         android:id="@+id/view_eqpt_id"
3         android:layout_width="fill_parent"
4         android:layout_height="wrap_content"
5         android:inputType="text"
6         android:editable="false" />

最后一行提示:android:editable is deprecated: Use inputType instead,原來editable屬性已經過時,google不再建議用戶使用,可以用inputType屬性代替,但是inputType屬性值列表中並沒有表示不可編輯的,經過多次嘗試,發現可以用android:focusable設置:

1 <EditText 
2         android:id="@+id/view_eqpt_id"
3         android:layout_width="fill_parent"
4         android:layout_height="wrap_content"
5         android:inputType="text"
6         android:focusable="false" />

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM