我正在一家教育機構的 Android Studio 中使用 XML 學習 Android 應用程式開發。我看到了這樣的代碼:
<EditText
android:id=”@ id/MU_EditText_id”
android:layout_width="match_parent"
android:layout_height="wrap-content"
android:hint="Please login e-mail adress"
android:textSize="15px"
android:inputType="textEmailAdress"
android:maxLines="1"
/>
這android:id部分引起了我的注意。這個id怎么這么長?不能有更簡單的用法嗎?提前感謝您提供的寶貴資訊。
uj5u.com熱心網友回復:
id 可以長也可以短,只要你喜歡。android:id=”@ id/是必要的,但之后的所有內容都是您的 ui 元素所參考的 id,并且由您來命名。id 也可以只是一個字符,但最好的做法是根據它們是什么或它們的用途來命名你的 id。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/522335.html
標籤:安卓xml
