谷歌地图V2在Android屏幕的上半部分和Android屏幕下半部分的列表视图

4 java android google-maps-api-2

我正在开发一个Android项目,我需要Google Map v2在Android屏幕的上半部分和同一个Android屏幕的下半部分显示,我需要显示一个ListView.

下面是我到目前为止的代码,它将在我启动我的应用程序后立即启动.我已正确设置AndroidManifest.xml文件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);
                    }
                });
    }

}
Run Code Online (Sandbox Code Playgroud)

以下是sample.xml file我需要修改的内容,以便我可以Google Map v2在Android屏幕的上半部分添加内容,在下半部分,我会有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>
Run Code Online (Sandbox Code Playgroud)

谁能帮我这个?我完成了与设置Google Map API v2密钥相关的所有设置.我只需要插入代码,开始在Android屏幕的上半部分显示谷歌地图v2,并在android屏幕的下半部分列出视图.

任何帮助将不胜感激.谢谢

更新: -

这个更新的XML文件是否可以在Android屏幕的上半部分安装Google Map v2,在Android屏幕的下半部分使用ListView?

<?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>
Run Code Online (Sandbox Code Playgroud)

Emi*_*Adz 12

这个布局应该在屏幕的上半部分显示一个地图,下半部分是一个ListView:

<?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>
Run Code Online (Sandbox Code Playgroud)