java - Google Map V2 on Top half of the android screen and list view on the bottom half of the android screen -
i working on android project in need show google map v2
on top half of android screen , in bottom half of same android screen, need show listview
.
below code, have far launched launch application. have setup androidmanifest.xml
file google map v2 key
.
public class sampleactivity extends activity { @targetapi(11) @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.sample); if (build.version.sdk_int >= build.version_codes.honeycomb) { getactionbar().hide(); } findviewbyid(r.id.sample_button).setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { int width = (int) typedvalue.applydimension( typedvalue.complex_unit_dip, 40, getresources() .getdisplaymetrics()); slideoutactivity.prepare(sampleactivity.this, r.id.inner_content, width); startactivity(new intent(sampleactivity.this, menuactivity.class)); overridependingtransition(0, 0); } }); } }
and below sample.xml file
need modify can add stuff have google map v2
in top half of android screen , in bottom half, have listview
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/inner_content" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/bg_android" > <relativelayout android:layout_width="fill_parent" android:layout_height="45dip" android:paddingleft="2dip" android:paddingright="2dip" android:background="#bb000000"> <button style="@android:style/widget.button.small" android:id="@+id/sample_button" android:layout_width="35dip" android:layout_height="wrap_content" android:layout_marginright="10dip" android:layout_centervertical="true" android:layout_alignparentleft="true" android:text=">" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_torightof="@id/sample_button" android:layout_centervertical="true" android:textsize="19sp" android:textcolor="#ffffff" android:text="facebook-like slide-out nav"/> </relativelayout> </relativelayout>
can me this? done settings related setting google map api v2 key. need plugin code start showing google map v2 on top half of android screen , list view on bottom half of android screen.
any appreciated on this. thanks
update:-
will updated xml file work have google map v2 on top half of android screen , listview on bottom half of android screen?
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/inner_content" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/bg_android" > <linearlayout android:layout_width="fill_parent" android:layout_height="45dip" android:background="#bb000000" android:paddingleft="2dip" android:paddingright="2dip" > <button android:id="@+id/sample_button" style="@android:style/widget.button.small" android:layout_width="35dip" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_centervertical="true" android:layout_marginright="10dip" android:text=">" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:layout_torightof="@id/sample_button" android:text="proximity application" android:textcolor="#ffffff" android:textsize="19sp" /> </linearlayout> <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.mapfragment" /> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="0.8" android:orientation="horizontal" > <listview android:id="@+id/mylist" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" > </listview> </linearlayout> </linearlayout>
this layout should present map in top half of screen listview in bottom half:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1.0" android:orientation="vertical" > <fragment xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/map" android:name="com.google.android.gms.maps.supportmapfragment" android:layout_width="match_parent" android:layout_height="match_parent"/> </linearlayout> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1.0" android:orientation="vertical" > <listview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/list"> </listview> </linearlayout> </linearlayout>
Comments
Post a Comment