还有让listview在左边
时间: 2024-03-27 12:40:48 浏览: 18
要将 ListView 放在 MapView 的左边,可以使用 `LinearLayout` 和 `android:orientation="horizontal"` 属性实现。同时,将 `MapView` 的宽度设置为 `0dp`,权重为 1,让它充满剩余的空间。代码如下:
```
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/poi_list_container"
android:layout_width="wrap_content"
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:scrollbars="none" />
</RelativeLayout>
<com.baidu.mapapi.map.MapView
android:id="@+id/bmapView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:focusable="true"
android:hardwareAccelerated="true" />
</LinearLayout>
```
这样就可以将 ListView 放在 MapView 的左边了。注意,这里使用了 `LinearLayout` 来实现,因为它可以让子 View 水平排列。同时,将 `MapView` 的宽度设置为 `0dp`,权重为 1,让它充满剩余的空间。