Android: how to properly use list items provided by the platform?
On this page: Is given on this page: http://developer.android.com/resources/tutorials/views/hello-listview.html. , the below tip is given.
Tip: You can use list item designs provided by the platform instead of 开发者_如何学编程 defining your own layout file for the ListAdapter. For example, try using android.R.layout.simple_list_item_1 instead of R.layout.list_item.
However, is it safe to use "simple_list_item_1"? Is it guaranteed that all platforms will provide a list item with this id?
Edit - yes, apparently these are bundled with Android and they should be supported on all platforms.
In any case, I believe what happens is that they are copied from the SDK into your project when you reference them.
As Felix pointed out, they are included on the device itself and they are considered to be part of the API.
You can see layouts available within the SDK on the Android gitweb. For example, simple_list_item_1.xml.
Those layouts part of the SDK and should be included on all devices.
精彩评论