android中的底部栏布局
这是我的android xml源代码,用于地图底部栏布局。我在屏幕上显示一个巨大的地图,我需要在屏幕底部有一个30dp高的布局来显示一些标签式的图像。如何将水平线性布局推送到页面底部android中的底部栏布局,android,layout,android-layout,android-xml,Android,Layout,Android Layout,Android Xml,这是我的android xml源代码,用于地图底部栏布局。我在屏幕上显示一个巨大的地图,我需要在屏幕底部有一个30dp高的布局来显示一些标签式的图像。如何将水平线性布局推送到页面底部 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height=" what he
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height=" what here ? "
android:layout_width="fill_parent"
android:orientation="vertical">
<com.google.android.maps.MapView
android:id="@+id/map_view"
Map goes here. Almost full screen. Exactly full - 30dp;
/>
<LinearLayout>
I want 3 images here. Bottom of the screen.
</LinearLayout>
</RelativeLayout>
我想要3张图片在这里。屏幕底部。
尝试以下布局。使用android:layout\u alignParentBottom=“true”
是不够的,因为使用android:layout\u height=“fill\u parent”
的地图视图将填充整个屏幕并隐藏线性布局。您还必须在上面添加android:layout_=“@id/menu”
,这样它就不会隐藏它
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.google.android.maps.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/menu"
android:apiKey="@string/google_maps_api_key"
android:clickable="true" />
<LinearLayout
android:id="@+id/menu"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true" >
</LinearLayout>
</RelativeLayout>
使用RelativeLayout的属性,如
android:layout\u alignParentBottom
和android:layout\u Upper
我会这样做:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
android:id="@+id/footer"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:width="fill_parent"
android:height="30dp">
add your images here
</LinearLayout>
<com.google.android.maps.MapView
android:id="@+id/map_view"
android:height="fill_parent"
android:width="fill_parent"
android:layout_alignParentTop="true"
android:layout_above="@id/footer"/>
</RelativeLayout>
在此处添加您的图像
使用android:layout\u alignParentBottom=“true”
在linearlayout的父级底部设置linearlayout,在mapview的上面使用android:layout\u在linearlayout的上方设置mapview
您的代码将是:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<LinearLayout android:layout_height="30dip"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:id="@+id/linearLayout1"
>
<!-- ... -->
</LinearLayout>
<com.google.android.maps.MapView
android:id="@+id/map_view"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_above="@+id/linearLayout1"
/>
</RelativeLayout>
请参见以下内容:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<LinearLayout android:layout_height="30dip"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:id="@+id/linearLayout1"
>
<!-- ... -->
</LinearLayout>
<com.google.android.maps.MapView
android:id="@+id/map_view"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_above="@+id/linearLayout1"
/>
</RelativeLayout>