处理一个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. 关于关闭TAB,IFRAME占用的内存不能释放问题

    资料来源:http://jxd-zxf.iteye.com/blog/1440611 使用TAB时注意,如果TAB是引用IFRAME,关闭TAB时IFRAME不会被销毁从而导致内存不能释放,大量使用T ...

  2. mybatis3 @SelectProvider

    mybatis3中增加了使用注解来配置Mapper的新特性,本篇文章主要介绍其中几个@Provider的使用方式,他们是:@SelectProvider.@UpdateProvider.@Insert ...

  3. 我在JS上解惑之路1

    1.为什么既然存在等号(==)非等号  (!=),又会有全等号(===)非全等号(!==)? *唯一的不同是后者判断时不进行类型转换. 例:var sNum = "66"; var ...

  4. What is API Level?

    [What is API Level?] 参考:http://android.xsoftlab.net/guide/topics/manifest/uses-sdk-element.html#ApiL ...

  5. java程序运行时间

    方法一 long startTime = System.currentTimeMillis(); //获取开始时间 doSomething(); //测试的代码段 long endTime = Sys ...

  6. ORACLE system表空间满

    解决方法:执行迁移命令,将AUD$表相关移到其它表空间中,也可以新建 一个审计 表空间 / MB DESC) ; alter table aud$ move tablespace SIEBELINDE ...

  7. 带图标的input

    <style> .text{ border:solid 2px #ccc; width:400px; height:40px; background:url(http://d.lanren ...

  8. C++ volatile

    volatile的位置与const相同——都是作为类型的附加修饰符 使用volatile的主要目的是提示编译器该对象的值可能在编辑器未监测的情况下被改变,因此编译器不能武断地对引用这些对象的代码作优化 ...

  9. mysql基本的增删改查和条件语句

    增 insert into 表名(列名,列名......) values("test1",23),("test2",23),("test3" ...

  10. Unable to get the default Bean Validation factory

    前几天看了一下教程 ,自己试着配置了一下web下的hibernate,悲剧的时,出错了提示下面: 信息: Hibernate Validator bean-validator-3.0-JBoss-4. ...