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 ...
随机推荐
- git cherry-pick用法
场景: 如果你的应用已经发布了一个版本2.0, 代码分支叫release-2.0, 现在正在开发3.0, 代码的分支叫dev-3.0. 那么有一天产品说, 要把正在开发的某个特性提前上线, 也就是说要 ...
- maven配置国内镜像库
https://www.cnblogs.com/xiongxx/p/6057558.html
- springmvc处理url请求步骤
处理步骤: 1.调用DispatcherServlet的doService方法 2.进入DispatchServlet的doDispatch方法 3.进入DispatchServlet的getHand ...
- Spring Retry
最近组内准备将项目中原有的重试功能抽取出来重构为一个重试平台,由于对重试的功能要求比较高,采用了不少中间件和框架(jimdb,jproxy, Elastic-Job ,JMQ,Hbase, Disru ...
- 第八章 高级搜索树 (b1)B-树:动机
- 42. Trapping Rain Water (Array,stack; DP)
Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...
- Petya and Array (权值线段树+逆序对)
Petya and Array http://codeforces.com/problemset/problem/1042/D time limit per test 2 seconds memory ...
- JAVA序列化和反序列化 对象<=>IO流 对象<=>字节数组
http://developer.51cto.com/art/201202/317181.htm http://blog.csdn.net/earbao/article/details/4691440 ...
- IIS上发布站点后URL重写失效的解决方法
在发布网站时URL重写有可能会失效,如果失效的话就需要您设置一下IIS:1.Windows XP系统或Windows 2003系统等使用以下方法:>打开IIS,主目录-〉配置-〉映射-〉在窗体左 ...
- leetcode 196. Delete Duplicate Emails
# 慢,内连接delete p1 from Person p1, Person p2 where p1.Email=p2.Email and p1.Id>p2.Id delete from Pe ...