[TIP] list และ empty id

|
The list and empty IDs are provided for us by the Android platform, so, we must prefix the id with android: (e.g., @android:id/list).

ID ชื่อ list และ empty มักเคยเห็นกันบ่อยๆ คงจะเป็นมาตรฐานอะไรซักอย่าง เหมือนเคยอ่านเค้าแนะนำว่าถ้ามีการใช้ listview ควรจะมี id ชื่อ @android:id/list เอาไว้ด้วย

The View with the empty id is used automatically when the ListAdapter has no data for the ListView. The ListAdapter knows to look for this name by default. Alternatively, you could change the default empty view by using setEmptyView(View) on the ListView.

ถ้าเกิด listview ไม่มีข้อมูล มันจะไปใช้ view ที่มี id เป็น empty ให้อัตโนมัติ (ดีแฮะ)

More broadly, the android.R class is a set of predefined resources provided for you by the platform, while your project's R class is the set of resources your project has defined. Resources found in the android.R resource class can be used in the XML files by using the android: name space prefix (as we see here).

ตามนั้น

0 ความคิดเห็น:

แสดงความคิดเห็น