【发布时间】:2019-03-15 13:58:55
【问题描述】:
我正在尝试创建一个地图应用程序,它允许您使用两个按钮在地图和卫星视图之间切换。但是,当我添加这两个按钮时,地图会缩小到不占用设备的全屏。
如何使地图占据整个屏幕,然后向下滚动时按钮位于该屏幕下方?这是布局文件的代码:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_height="wrap_content"
android:layout_width="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:uiZoomControls="true"
tools:context=".MapsActivity" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Map View"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Satellite View"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
【问题讨论】:
标签: android xml google-maps android-layout mapfragment