<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/poi_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false" android:orientation="horizontal"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:id="@+id/poi_list_container" android:layout_width="360dp" android:layout_height="match_parent" android:layout_above="@id/bmapView" android:background="@drawable/bg_list_circular" android:visibility="gone"> <ListView android:id="@+id/poi_list" android:layout_width="match_parent" android:layout_height="match_parent" android:hardwareAccelerated="true" android:scrollbars="none" /> </RelativeLayout> <!-- <RelativeLayout--> <!-- android:layout_width="0dp"--> <!-- android:layout_height="match_parent"--> <!-- android:layout_weight="3">--> <com.baidu.mapapi.map.MapView android:id="@+id/bmapView" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentTop="true" android:clickable="true" android:focusable="true" android:hardwareAccelerated="true" /> </RelativeLayout> </LinearLayout> 这样写的话显示不出来listview,我想要的结果是 将RelativeLayout包裹的listview放到mapview之后,并且显示在布局的左侧,不占用mapview的空间
时间: 2023-07-19 11:47:50 浏览: 56
非常抱歉,我之前的回答仍然有误。您可以尝试以下代码来实现您想要的效果:
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/poi_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/poi_list_container"
android:layout_width="360dp"
android:layout_height="match_parent"
android:background="@drawable/bg_list_circular"
android:visibility="gone">
<ListView
android:id="@+id/poi_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hardwareAccelerated="true"
android:scrollbars="none" />
</RelativeLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.baidu.mapapi.map.MapView
android:id="@+id/bmapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:hardwareAccelerated="true" />
<RelativeLayout
android:layout_width="360dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="@android:color/transparent">
<!-- Add any other views you want to display here -->
</RelativeLayout>
</FrameLayout>
</LinearLayout>
```
这个布局将ListView包裹在RelativeLayout中,并在左侧显示,不占用MapView的空间。通过将RelativeLayout放置在FrameLayout中,可以将其叠加在MapView上,从而实现您想要的效果。