处理一个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. 【Java】JVM(四)、虚拟机参数配置

    1. -Xms20M      JVM启动时候的内存大小为20M   2. -Xmx20M     JVM内存最大值是20M 将其与Xms大小一致可以避免JVM内存自动扩展   3. -Xss128K ...

  2. SO\PR回写的数据如下

    insert into OUT_ORDER_RES ---JAVA FOR PR ) as LGORT ,'SAPRFC' as ERNAM,out_pr.due_datetime,out_pr.so ...

  3. MongoDB服务无法启动,发生服务特定错误:100

    问题:MongoDB服务无法启动,发生服务特定错误:100 原因:没有正常关闭mongod服务,导致mongod被锁 解决方案:进入db文件夹,删除mongod.lock文件,然后重新启动服务即可

  4. 使用git提交代码到GitHub

    0.下载Git Bash,在Windows系统可以用Git Bash通过简单的命令将代码提交到GitHub1.打开项目所在的文件夹,右键,"Git Bash Here"2.初次使用 ...

  5. ubuntu下 openvpn客户端的配置

    1.安装openvpn sudo apt-get install openvpn 2.配置openvpn 作为客户端,OpenVPN并没有特定的配置文件,而是由服务器提供方给出一个配置文件.对于认证, ...

  6. goim源码分析与二次开发-comet分析一

    因为要完成一个聊天的项目,所以借鉴了goim,第一篇分析打算半原版,先摘抄http://www.jianshu.com/p/8bd96a9a473d他的一些理解,写这些还是为了让自己更好的理解这个项目 ...

  7. MyBatis核心配置文件详解

    ------------------------siwuxie095                                     MyBatis 核心配置文件详解         1.核心 ...

  8. python的错误类型和异常处理

    # isinstance() # 判断实例a是否属于类b # issubclass() # 判断类a是否为类b的派生类 # 异常处理 try: pass #Exception是错误类型,能catch到 ...

  9. dede中arcurl的解析

    有时候我们需要在dede中通过$dsql查询出文章数据,并生成文章的地址. 但是dede默认的dede_archives和附加表dede_addonarticle都没有存放arcurl的字段. 说明a ...

  10. discuz的diy功能介绍

    可以通过页面操作的方式,完成页面布局设计,数据聚合,样式等常见的页面处理功能.   以管理员登陆discuz的前台时,会出现一个diy按钮. 流程,先设计框架,再完成数据的聚合.     定义模板时, ...