according screenshots want achieve following screenui (android api >= 10):
you have googlemapssupportfragement
, listview
, share remaining height of view (height
calculated @ application start, , application runnning in portraitmode
)
the behaviour of listview
container should similar android-notification menu, user can swipe list in , out, animation starts, if user releases view (touch up).
so far, implemented 2 linearlayout
(map
, listview
) divided redline (linearlayout
). managed, listview shown/hidden on click @ redline, it`s looking odd if hide listview, because map redrawn , leaves black space..
question is: whats best way implement (linearlayout? fragments?)? know examples the
ontouchbehaviour` (similar open notication menu)?
here's implementation:
//function triggered @ click on redline-button private void toggleoverlaylist(){ //test case api >= 11 int mlistheight = ((linearlayout) findviewbyid(r.id.map_list)).getlayoutparams().height; log.i(debug,"toggleoverlaylist() -> currentheight:" + mlistheight ); if(mlistheight == 0){ ((linearlayout) findviewbyid(r.id.map_wrapper)).getlayoutparams().height = mdisplayheight; ((linearlayout) findviewbyid(r.id.map_list)).getlayoutparams().height = mdisplayheight; ((linearlayout) findviewbyid(r.id.main_screen)).requestlayout(); } else{ ((linearlayout) findviewbyid(r.id.map_wrapper)).getlayoutparams().height = 2* mdisplayheight; ((linearlayout) findviewbyid(r.id.map_list)).getlayoutparams().height = 0; ((linearlayout) findviewbyid(r.id.main_screen)).requestlayout(); } }
layout.xml
<linearlayout android:id="@+id/main_screen" android:animatelayoutchanges="true" android:orientation="vertical" > <linearlayout android:id="@+id/map_wrapper"> <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.mapfragment" /> </linearlayout> <linearlayout android:id="@+id/map_seperator" android:layout_height="20dp" > </linearlayout> <linearlayout android:id="@+id/map_list"> <listview android:id="@+id/listview1" > </listview> </linearlayout> </linearlayout>
Comments
Post a Comment