处理一个Dialog,发现RelativeLayout布局下最后一个View的layout_marginBottom会失效.
效果图见:

解决方法为:
在最底或最右的组件后面再加个View吧...
这个现象挺特别的,发帖记录一下。

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"
android:gravity="center"
android:background="#80000000">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/dlgLayoutMain"
android:paddingBottom="18dp"
android:background="@drawable/micro_phone_dlg_bg">
<!-- 录音界面 -->
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txtMicroPhoneHint"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:textSize="18.5sp"
android:textColor="#ff555555"
android:text="@string/micro_phone_what_2_say"/>
<!-- 话筒、音波 -->
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/img_micro_phone"
android:background="@drawable/ic_launcher"
android:layout_below="@id/txtMicroPhoneHint"
android:layout_marginTop="15dp"
android:layout_centerHorizontal="true"/>
<Button android:layout_width="fill_parent"
android:layout_height="36dp"
android:id="@+id/btnPressed2Talk"
android:text="@string/aio_press_speak_label"
android:textSize="18.5sp"
android:textColor="#ffffff"
android:layout_below="@id/img_micro_phone"
android:layout_marginLeft="18dp"
android:layout_marginRight="18dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="18dp"
android:layout_centerHorizontal="true"
android:background="#ff123456"
/>
<!-- 把下面的view注释掉,则发现btnPressed2Talk的marginBottom无效 -->
<View android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@id/btnPressed2Talk"
/>
</RelativeLayout>
</RelativeLayout>

RelativeLayout中最底的View一个View.layout_marginBottom无效的更多相关文章

  1. android2.3 View视图框架源码分析之一:android是如何创建一个view的?

    View是所有控件的一个基类,无论是布局(Layout),还是控件(Widget)都是继承自View类.只不过layout是一个特殊的view,它里面创建一个view的数组可以包含其他的view而已. ...

  2. IOS中封装一个View的思路

    一.封装一个View的思路 1.将View内部的业务逻辑(显示内容)封装到View中 2.一般情况下,View的位置应该由父控件来决定,也就是位置不应该固定死在View内部 3.至于View的宽高,根 ...

  3. 在Android中动画移动一个View的位置,采用Scroller类实现Android动画之 View移动

    在Android中动画移动一个View的位置,采用Scroller类实现 今天说最近自己遇到的一个问题,就是要用动画效果来移动一个VIew的位置. 这个具体的情况是,需要做一个SlidingMenu的 ...

  4. android——仿网易今日头条等自定义频道listview 或者grideview等item上移到另一个view中

    转载请注明出处: www.cnblogs.com/shoneworn 我这里只是简单的用了两个listview来实现的,先上效果图.比较粗糙.预留了自定义的空间. 思路: 从上图应该可以看的出来.就是 ...

  5. android 给LinearLayout中添加一定数量的控件,并让着一定数量的控件从右到左移动,每隔若干秒停顿一下,最后一个view链接第一个view,然后继续移动循环往复,形成一个死循环简单动画效果

    主类:IndexAnimationLinearLayout.java package com.yw.sortlistview; import java.util.ArrayList; import j ...

  6. 从一个子视图或者一个View中刷新其他UITableView

    被问到了一个问题:如何从一个子视图或者一个View中刷新其他UITableView,常规的写法可能是这样的 TestTVC*testTVC =[[TestTVC alloc] init];[testT ...

  7. IOS中使用.xib文件封装一个自定义View

    1.新建一个继承UIView的自定义view,假设类名叫做 MyAppVew #import <UIKit/UIKit.h> @class MyApp; @interface MyAppV ...

  8. 无废话Android之listview入门,自定义的数据适配器、采用layoutInflater打气筒创建一个view对象、常用数据适配器ArrayAdapter、SimpleAdapter、使用ContentProvider(内容提供者)共享数据、短信的备份、插入一条记录到系统短信应用(3)

    1.listview入门,自定义的数据适配器 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/and ...

  9. MVVM模式解析和在WPF中的实现(五)View和ViewModel的通信

    MVVM模式解析和在WPF中的实现(五) View和ViewModel的通信 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 M ...

随机推荐

  1. t检验,T Test (Student’s T-Test)

    1.什么是T test? t-test:比较数据的均值,告诉你这两者之间是否相同,并给出这种不同的显著性(即是否是因为偶然导致的不同) The t test (also called Student’ ...

  2. Xpath同时选取不同属性的元素

    如:一个论坛中,有置顶贴和普通贴,它们使用了不同的class,但这两类帖子都是需要的内容,需要同时爬下来 假设置顶贴class="top",普通贴class="commo ...

  3. overflow: scroll

    overflow: scroll在安卓5.0的情况下,不论内容是否填满屏幕,都会强制解析出滚动条,所以最好是使用overflow: auto

  4. Redis网络协议

    Redis网络协议较为简单,易于阅读. 命令或数据已\r\n结尾,但除了状态回复,其他数据都是二进制安全的(包含长度) 头部如下: + 正确的状态信息,具体信息是当前行+后面的字符. -  一条错误信 ...

  5. OC 线程操作 - GCD使用 - 栅栏函数

    - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ //同步函数无需栅栏函数 //栅栏 ...

  6. 演示Spring框架的JDBC模板的简单操作

    1. 步骤一:创建数据库的表结构 create database spring_day03; use spring_day03; create table t_account( id int prim ...

  7. Redis数据持久化

    持久化选项 Redis提供了两种不同的持久化方法来将数据存储到硬盘里面.一种方法叫快照(snapshotting),它可以将存在于某一时刻的所有数据都写入硬盘里面.另一种方法叫只追加文件(append ...

  8. 从输入url到显示网页发生了什么

    原文链接:https://juejin.im/post/5bf23afa6fb9a049be5d1494 在浏览器中输入url到显示网页主要包含两个部分: 网络通信和页面渲染 互联网内各网络设备间的通 ...

  9. 一定要 先删除 sc表 中的 某元组 行,,, 再删除 course表中的 元组行

    一定要  先删除 sc表 中的  某元组   行,,, 再删除  course表中的  元组行 course表 SC表 删除  course表中的  元组行,,出现错误 sc    ---->参 ...

  10. 中介者模式(QQ聊天室我觉得是个很生动的例子简单易懂)

    设计模式之中介者模式(Mediator) 一.初识中介者模式 那些年,我们一起上过的大学,班级里有班长,有团书记.想一想如果没有QQ这种通讯工具的话,那么班长或者团支书该怎样下达消息呢??同时,班级上 ...