首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android --以一种独立的方式,以固定的顶部和底部元素布局屏幕?

Android --以一种独立的方式,以固定的顶部和底部元素布局屏幕?
EN

Stack Overflow用户
提问于 2011-03-31 06:48:42
回答 2查看 605关注 0票数 0

我有这样的布局

  • Button
  • MapView
  • Button

我希望按钮是一个固定的大小&分别锚定在屏幕的顶部和底部。我要把地图放在中间,把空间填满。

实现这一目标的最佳方法是什么?

谢谢

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-03-31 06:54:50

使用垂直方向的LinearLayout,将Mapview的权重设为1

票数 2
EN

Stack Overflow用户

发布于 2011-03-31 06:58:06

像这样的事情应该能起作用:

代码语言:javascript
复制
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<Button
    android:id="@+id/button"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"/>

<WhateveerMapLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/button"
    android:layout_above="@+id/button2"
    />

<Button
    android:id="@id/button2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    /> 


</RelativeLayout>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5496181

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档