If you are idle, find some information on the Internet to learn. You can see the implementation of the listview rounded corner design on the 360 moji weather setting interface on the Internet. But encountered problems ....
Moji weather map:
Here we use the shape in Android to implement it. It is relatively simple to implement, but it is a little troublesome during scrolling...
When multiple listview lists exceed its parent control linearlayout, each of them will have its own scrolling, which is not the expected effect, I first wanted to add a layer of scrollview outside linearlayout, but as a result, we encountered a problem of scrollview and listview conflicts, which would cause incomplete display of listview. Borrow onlineCodeUnderstanding: We only have to fix the height of the listview so that it will not conflict with scrollview if it is not adjusted automatically. The Code is as follows:
/***** Dynamically set the height of the listview ** @ Param listview */Public void setlistviewheightbasedonchildren (listview) {listadapter = listview. getadapter (); If (listadapter = NULL) {return;} int totalheight = 0; For (INT I = 0; I <listadapter. getcount (); I ++) {view listitem = listadapter. getview (I, null, listview); listitem. measure (0, 0 );//You cannot obtain the view width before creating a view. Before that, we must select measure.
Totalheight + = listitem. getmeasuredheight ();} viewgroup. layoutparams Params = listview. getlayoutparams (); Params. height = totalheight + (listview. getdividerheight () * (listadapter. getcount ()-1); // Params. height + = 5; // If without this statement, the listview will be // A // little short // listview. getdividerheight () obtains the height occupied by separators between subitems. // Params. the height finally shows the required height for the entire listview. setlayoutparams (Params );}
After we call the setadapter of listview, this method will be OK, so that the height of the listview is customized according to the content.