I'm trying to preview a ListFragment
in the Graphical Layout Editor. As it has no fragment layout to preview, I simply created an xml with a ListView
inside, just to see how the items look, and set Preview List Content with one of the default item layouts, just to try.
The problems are:
The list in the preview is empty, no matter what Preview List Content I choose;(I don't know what I was doing wrong, now it works)- I want to preview my own custom list item View, not just a layout, because I'll be doing few things when
isInEditMode()
is true.
Any idea?
EDIT: The fragment is a ListFragment
, but I can live with using a "temporary" listview.xml layout. What I want is a way to see a listview with my CustomListItemView
inside. In the fragment, I'll place them there with a custom adapter; in the layout editor I wish I could choose CustomListItemView
from Preview List Content menu.
I can't just use the custom item's layout as Preview List Content, because its root is a <merge>
(my custom item extends RelativeLayout
). This could be solved by changing for a moment <merge>
into <RelativeLayout>
. However, this custom item view changes depending on data, so I'd love to see a preview of the various states, by using the isInEditMode()
facility.
The best would be if it all could work without the temporary listview.xml layout, but this is becoming a feature request.
Right now I'm resorting to use a vertical LinearLayout
.