Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 让谷歌地图不是全屏安卓应用_Java_Android_Xml_Google Maps - Fatal编程技术网

Java 让谷歌地图不是全屏安卓应用

Java 让谷歌地图不是全屏安卓应用,java,android,xml,google-maps,Java,Android,Xml,Google Maps,我正在尝试实现一个应用程序,它显示一个地图,下面有几个文本字段和几个按钮 但当我打开应用程序时,整个屏幕空间都被地图占据了。有没有一种方法可以让所有对象都很好地填充屏幕而不隐藏其中一个 这是activity_主xml文件中的代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:l

我正在尝试实现一个应用程序,它显示一个地图,下面有几个文本字段和几个按钮

但当我打开应用程序时,整个屏幕空间都被地图占据了。有没有一种方法可以让所有对象都很好地填充屏幕而不隐藏其中一个

这是activity_主xml文件中的代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<fragment
      android:id="@+id/map"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:name="com.google.android.gms.maps.MapFragment"/>

<EditText android:id="@+id/EditTest"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/EditTest" />

<EditText android:id="@+id/inTegerTest"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/integerTest" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/ButtonTest" />

任何帮助都将不胜感激。

尝试使用线性布局和重量:

<LinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical">

<fragment
    android:id="@+id/map"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:name="com.google.android.gms.maps.MapFragment"
    android:layout_weight="4"/>

<EditText android:id="@+id/EditTest"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:hint="@string/EditTest"
    android:layout_weight="1"/>

<EditText android:id="@+id/inTegerTest"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:hint="@string/integerTest"
    android:layout_weight="1"/>

<Button
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:text="@string/ButtonTest"
    android:layout_weight="1"/>

</LinearLayout>

根据需要改变重量

有关体重的更多信息:

<LinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical">

<fragment
    android:id="@+id/map"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:name="com.google.android.gms.maps.MapFragment"
    android:layout_weight="4"/>

<EditText android:id="@+id/EditTest"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:hint="@string/EditTest"
    android:layout_weight="1"/>

<EditText android:id="@+id/inTegerTest"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:hint="@string/integerTest"
    android:layout_weight="1"/>

<Button
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:text="@string/ButtonTest"
    android:layout_weight="1"/>

</LinearLayout>