RelativeLayout中最底的View一个View.layout_marginBottom无效
处理一个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无效的更多相关文章
- android2.3 View视图框架源码分析之一:android是如何创建一个view的?
View是所有控件的一个基类,无论是布局(Layout),还是控件(Widget)都是继承自View类.只不过layout是一个特殊的view,它里面创建一个view的数组可以包含其他的view而已. ...
- IOS中封装一个View的思路
一.封装一个View的思路 1.将View内部的业务逻辑(显示内容)封装到View中 2.一般情况下,View的位置应该由父控件来决定,也就是位置不应该固定死在View内部 3.至于View的宽高,根 ...
- 在Android中动画移动一个View的位置,采用Scroller类实现Android动画之 View移动
在Android中动画移动一个View的位置,采用Scroller类实现 今天说最近自己遇到的一个问题,就是要用动画效果来移动一个VIew的位置. 这个具体的情况是,需要做一个SlidingMenu的 ...
- android——仿网易今日头条等自定义频道listview 或者grideview等item上移到另一个view中
转载请注明出处: www.cnblogs.com/shoneworn 我这里只是简单的用了两个listview来实现的,先上效果图.比较粗糙.预留了自定义的空间. 思路: 从上图应该可以看的出来.就是 ...
- android 给LinearLayout中添加一定数量的控件,并让着一定数量的控件从右到左移动,每隔若干秒停顿一下,最后一个view链接第一个view,然后继续移动循环往复,形成一个死循环简单动画效果
主类:IndexAnimationLinearLayout.java package com.yw.sortlistview; import java.util.ArrayList; import j ...
- 从一个子视图或者一个View中刷新其他UITableView
被问到了一个问题:如何从一个子视图或者一个View中刷新其他UITableView,常规的写法可能是这样的 TestTVC*testTVC =[[TestTVC alloc] init];[testT ...
- IOS中使用.xib文件封装一个自定义View
1.新建一个继承UIView的自定义view,假设类名叫做 MyAppVew #import <UIKit/UIKit.h> @class MyApp; @interface MyAppV ...
- 无废话Android之listview入门,自定义的数据适配器、采用layoutInflater打气筒创建一个view对象、常用数据适配器ArrayAdapter、SimpleAdapter、使用ContentProvider(内容提供者)共享数据、短信的备份、插入一条记录到系统短信应用(3)
1.listview入门,自定义的数据适配器 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/and ...
- MVVM模式解析和在WPF中的实现(五)View和ViewModel的通信
MVVM模式解析和在WPF中的实现(五) View和ViewModel的通信 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 M ...
随机推荐
- python中的__name__=='__main__'如何简单理解(一)
1. 摘要: 通俗的理解_name_ == '_main_':假如你叫小明.py,在朋友眼中,你是小明(_name_ == '小明'):在你自己眼中,你是你自己(_name_ == '_main_') ...
- Ansible 从MySQL数据库添加或删除用户
mysql_user - 从MySQL数据库添加或删除用户. 概要 要求(在执行模块的主机上) 选项 例子 笔记 状态 支持 概要 从MySQL数据库添加或删除用户. 要求(在执行模块的主机上) My ...
- 使用python识别验证码
公司的登录注册等操作有验证码,测试环境可以让开发屏蔽掉验证码,但是如果到线上的话就要想办法识别验证码或必过验证码了. 识别验证码主要分为三部分,一.对验证码进行二值化.二.将二值化后的图片分割.三.进 ...
- Cookie的Domain属性
Cookie 加了Domain后就写不进去了(不加domain就可以写进去了) 本地测试的时候需要把domain换成localhost cookie跨域的问题,意思就是说A.com下能访问B.com域 ...
- java并发:读写锁ReadWriteLock
在没有写操作的时候,两个线程同时读一个资源没有任何问题,允许多个线程同时读取共享资源. 但是如果有一个线程想去写这些共享资源,就不应该再有其它线程对该资源进行读或写. 简单来说,多个线程同时操作同一资 ...
- 学习C++50条忠告
1.把C++当成一门新的语言学习: 2.看<Thinking In C++>,不要看<C++变成死相>: 3.看<The C++ Programming Language ...
- word2003设置页码不从第一页开始的方法
问题描述:如果你想设置页码从第三四页开始,前边不要页码,或者前边的页码是不同类型的.那么这个时候就要用到:插入->分隔符模式. 如果你的页面中的各个标题是从样式和格式中选择的,既是你先设置好各种 ...
- 配置静态IP
网卡配置静态IP地址编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces并用下面的行来替换有关eth0的行:# The primary ...
- 20172325 2017-2018-2 《Java程序设计》第八周学习总结
20172325 2017-2018-2 <Java程序设计>第八周学习总结 教材学习内容总结 1.关于绑定 绑定:在执行程序时产生一个请求事件,需要执行一段代码来来完成方法调用,即一个方 ...
- 向Ubuntu的Dash中添加图标
首先准备.xpm图标文件,如果程序文件夹中没有,那么可以根据自己喜好到网上下载喜欢的图标,不要太大,然后将其改为.xpm文件(直接改了后缀名就行).然后打开/usr/share/application ...