Android 相对地图视图中隐藏的线性布局
我有一个相对的地图视图。我现在尝试在这个地图视图上方设置一个线性布局,所以我的意思是在顶部,但是地图视图将填充整个屏幕 现在的问题是地图视图已显示,但id为“map\u ZoomControl”的线性布局已隐藏 有没有办法将线性布局带到前面Android 相对地图视图中隐藏的线性布局,android,android-layout,android-mapview,android-linearlayout,android-relativelayout,Android,Android Layout,Android Mapview,Android Linearlayout,Android Relativelayout,我有一个相对的地图视图。我现在尝试在这个地图视图上方设置一个线性布局,所以我的意思是在顶部,但是地图视图将填充整个屏幕 现在的问题是地图视图已显示,但id为“map\u ZoomControl”的线性布局已隐藏 有没有办法将线性布局带到前面 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_zoomcontrols"
android:layout_width="200dp"
android:layout_height="150dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#fff"
android:gravity="center_horizontal">
<Button
android:id="@+id/map_zoom_out"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="Out"
android:textColor="#fff"
android:background="#fff"
/>
<Button
android:id="@+id/map_zoom_in"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="In"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"
/>
</LinearLayout>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:apiKey="..."/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bottom_ll"
android:orientation="horizontal"
android:layout_width="400dp"
android:layout_height="45dp"
android:gravity="center_horizontal"
android:background="@drawable/gradient"
android:layout_alignParentBottom="true"
>
<Button android:id="@+id/btn_bottom"
android:layout_width ="120dp"
android:layout_height="35dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:text="Bottom"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"/>
</LinearLayout>
将
线性布局
放在xml布局中的映射视图
控件之后:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:apiKey="..."/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_zoomcontrols"
android:layout_width="200dp"
android:layout_height="150dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#fff"
android:gravity="center_horizontal">
<Button
android:id="@+id/map_zoom_out"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="Out"
android:textColor="#fff"
android:background="#fff"
/>
<Button
android:id="@+id/map_zoom_in"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="In"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_ll"
android:orientation="horizontal"
android:layout_width="400dp"
android:layout_height="45dp"
android:gravity="center_horizontal"
android:background="@drawable/gradient"
android:layout_alignParentBottom="true"
>
<Button android:id="@+id/btn_bottom"
android:layout_width ="120dp"
android:layout_height="35dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:text="Bottom"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"/>
</LinearLayout>
将
线性布局
放在xml布局中的映射视图
控件之后:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:apiKey="..."/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_zoomcontrols"
android:layout_width="200dp"
android:layout_height="150dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#fff"
android:gravity="center_horizontal">
<Button
android:id="@+id/map_zoom_out"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="Out"
android:textColor="#fff"
android:background="#fff"
/>
<Button
android:id="@+id/map_zoom_in"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="In"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_ll"
android:orientation="horizontal"
android:layout_width="400dp"
android:layout_height="45dp"
android:gravity="center_horizontal"
android:background="@drawable/gradient"
android:layout_alignParentBottom="true"
>
<Button android:id="@+id/btn_bottom"
android:layout_width ="120dp"
android:layout_height="35dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:text="Bottom"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"/>
</LinearLayout>
你能发布XML吗,或者是这方面的代码。好的,我现在发布了代码。你有什么想法吗?你能发布XML吗,或者这方面的代码。好的,我现在发布了代码。你有什么想法吗?哦,那很有效,太好了!!所以MapView隐藏了在..ok之前定义的所有元素。谢谢@Robinson 1RelativeLayout
允许子元素彼此重叠,因为您使用fill\u parent
定义了MapView
,它将覆盖布局中以前定义的任何元素。哦,这很有效,太好了!!所以MapView隐藏了在..ok之前定义的所有元素。谢谢@Robinson 1RelativeLayout
允许子元素彼此重叠,因为您使用fill\u parent
定义了MapView
,它将覆盖布局中以前定义的任何元素。