Android ListView with complex header -
i'm trying add complex / non-trivial header listview (and less complex footer) needs scroll along rest of content.
the header consists of
- a textview bold text, black transparent background , rounded corners
- a textview normal text, black transparent background
- an imageview
- a clickable button (actually imageview onclick) , divider
i'm familiar addheaderview, if try add complex view (consisting of linearlayout multiple children), see first child of complex header in listview header.
also, design breaks (because header may styled transparently, listview isn't. perhaps can solved adding more styling listview , entries (which shouldn't transparent), have impression i'm reaching listviews limits here.
can done? know of applications (or better, code examples) have similar complex header? other examples i've been able find trivial headers: buttons, textviews or images (online , on so) hardly interesting styling.
i've attempted reimplement scrolling listview scratch, follows:
a main.xml background image , single listview, 20dip margin , specific styling:
<item name="android:cachecolorhint">#00000000</item> <item name="android:scrollbars">@null</item> <item name="android:background">@android:color/transparent</item>
a headerlayout.xml containing linear layout (vertical), containing textview, imageview , textview. first textview styled rounded topcorners, both textviews styled transparent, , clicklistener on image.
- (a styled footer)
- a custom entry each listitem solid white background.
the header/footer added follows
listview list = (listview) findviewbyid(r.id.list); view header1 = getlayoutinflater().inflate(r.layout.listheader, null, false); view footer = getlayoutinflater().inflate(r.layout.listfooter, null, false); imageview image = (imageview) header1.findviewbyid(r.id.image); list.addheaderview(header1, null, false); list.addfooterview(footer, null, false); list.setadapter(new menuadapter());
none of truely special. it's matter of doing things in right order, stripped down , styled.
Comments
Post a Comment