android - Is there a way to specify a Layout to use for a ListView when the adapter is empty? -
i have complex empty view in layout, icon, text, button, etc.
it easy select view within layout.xml use when listview empty, similar to
getlistview().setemptyview(findviewbyid(r.id.empty));
code sets empty view works fine when resides in layout.xml file.
now want refactor view own empty.xml layout file, , have coded similar following:
// setup empty layout.xml layoutinflater vi = (layoutinflater) this.getsystemservice(context.layout_inflater_service); view vlempty = vi.inflate(r.layout.empty, null); // find empty layout view vempty = vlempty.findviewbyid(r.id.llempty); vempty.setonclicklistener(ocl); // find listview vlistview = (listview) findviewbyid(r.id.lvwords); vlistview.setemptyview(vempty);
the problem details within llempty never show up; exact same layout , view works withing main layout, not refactored own xml file.
has got work?
i doubt setemptyview()
automatically makes supplied view
child of container in activity.
personally, i'd use <include>
element rather inflating separately. but, if want inflate separately, answer femi posted while writing may work, depending on listview
's parent is.
Comments
Post a Comment