android - Display a lisView on mapView -
i want display listview on mapview in below image of google maps app.
initially map visible. when user clicks on tab want listview appear on mapview.
but problem using below layout not display maps(gray screen visible). however, listview
displayed.
layout :
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pickmatcheslayout" android:layout_width="match_parent" android:layout_height="match_parent" > <tabhost android:id="@+id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <tabwidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" > </tabwidget> <framelayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent" > <relativelayout android:id="@+id/map_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.mapfragment" android:layout_width="match_parent" android:layout_height="match_parent" /> <include layout="@layout/listview" > </include> </relativelayout> </framelayout> </linearlayout> </tabhost> </relativelayout>
method set tabs :
// set tabs private void setuptabs() { // tabhost tabhost = (tabhost) findviewbyid(r.id.tabhost); tabhost.setup(); // create tabs tabspec sourceonlystate = tabhost.newtabspec(source_only_state); sourceonlystate.setcontent(r.id.map); sourceonlystate.setindicator("source only"); tabspec allstate = tabhost.newtabspec(all_state); allstate.setcontent(r.id.map); allstate.setindicator("all"); tabspec maptypes = tabhost.newtabspec(map_features); maptypes.setcontent(r.id.map_layout); maptypes.setindicator("map types"); // add tabs in tabhost tabhost.addtab(sourceonlystate); tabhost.addtab(allstate); tabhost.addtab(maptypes); // set tab change listener tabhost.setontabchangedlistener(this); }
onclick of tab start new activity , code related listview in activity , set theme activity
android:theme="@android:style/theme.holo.dialog.noactionbar"
Comments
Post a Comment