这是我的 map - 底栏布局的 android xml 源代码。我在屏幕上显示一个巨大的 map ,我需要在屏幕底部有一个 30dp 高的布局来显示一些像图像这样的选项卡。如何将水平线性布局推到页面底部?
<?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>
最佳答案
使用 android:layout_alignParentBottom="true"
为 linearlayout 设置父级底部的线性布局,为 mapview 使用 android:layout_above
将 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>
关于android - android中的底部栏布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8679086/