android - android中的底部栏布局

标签 android layout android-layout android-xml

这是我的 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/

相关文章:

android - 如何使用 RelativeLayout 使 View 居中?

html - 为什么我的 Div 重叠?

android - 相对布局中缺少项目

javascript - mvc _layout 在 renderbody() 执行之前调用函数

android - 如何让 textview 从 26% 的屏幕开始一直到 96% 的屏幕?

java - 使用 RadioButtons 实现 TextWatcher

android - 处理产品口味时,main/AndroidManifest.xml 中的包名称应该是什么?

android - 更改 EditText 中的输入会更新 ScrollView 中的错误 EditText

android - 如何以编程方式或在操作栏选项卡中使用 xml 更改选定的选项卡背景颜色?

java - Android TextView 和 ProgressBar 未显示在 LinearLayout 中