<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/online_error_layout"android:layout_width="fill_parent"android:layout_height="fill_parent"android:background="#ffffff"android:orientation="vertical" ><ImageView
        android:id="@+id/imageView1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentTop="true"android:layout_centerHorizontal="true"android:layout_marginTop="120dp"android:focusableInTouchMode="false"android:src="@drawable/wifi_open" /><TextView
        android:id="@+id/tv_nonet"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerHorizontal="true"android:layout_below="@+id/imageView1"android:layout_marginTop="2dp"android:text="@string/online_error_tip"android:textColor="@color/zz_black_60_percent_transparent"android:textSize="13sp" /><Button
        android:id="@+id/online_error_btn_retry"android:layout_width="fill_parent"android:layout_height="wrap_content"android:layout_below="@id/tv_nonet"android:layout_marginTop="40dp"android:layout_marginBottom="14dp"android:layout_marginLeft="15dp"android:layout_marginRight="15dp"android:text="@string/online_error_retry"android:textSize="15sp" />
</RelativeLayout>

一开始的时候布局是:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/online_error_layout"android:layout_width="fill_parent"android:layout_height="fill_parent"android:background="#ffffff"android:gravity="center"android:orientation="vertical" ><ImageView
        android:id="@+id/imageView1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentTop="true"android:layout_centerHorizontal="true"android:layout_marginTop="120dp"android:focusableInTouchMode="false"android:src="@drawable/wifi_open" /><Button
        android:id="@+id/online_error_btn_retry"android:layout_width="fill_parent"android:layout_height="wrap_content"android:layout_alignParentBottom="true"android:layout_marginBottom="14dp"android:layout_marginLeft="15dp"android:layout_marginRight="15dp"android:text="@string/online_error_retry"android:textSize="15sp" /><TextView
        android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerHorizontal="true"android:layout_below="@+id/imageView1"android:layout_marginTop="2dp"android:text="@string/online_error_tip"android:textColor="@color/zz_black_60_percent_transparent"android:textSize="13sp" /></RelativeLayout>

没想到relativeLayout的grivate :center会影响到
我把bottom的那个东西删除之后的布局。就是整个布局都会居中,而不是全屏的显示了。

如果有空间贴着父控件的底部,

 android:layout_alignParentBottom="true"

,那么grivate =center不会有太大的作用,因为整个布局已经被占用完了,而如果你没有这个控件,你还写了grivate =center,那么控件的

android:layout_alignParentTop="true"android:layout_centerHorizontal="true"android:layout_marginTop="120dp"

控件的marginTop就会在布局的中间算margin,而不是顶部。

有grivate=center的布局效果:

没有grivate=center的布局效果:

被relativeLayout的grivate center 折腾死了相关推荐

  1. Myeclipse J2EE Project, 折腾死我了。

    这两天因为想测试一下群集Cache,用Myeclipse 建了一个测试程序,快把我折腾死了. 在Myeclipse的设计中,Project的粒度很细.EAR Project, WAR Project, ...

  2. 锁相放大器sr830_各位谁会用Stanford SR830啊,我都快被这个锁相放大器折腾死了!!!!-北京搜狐焦点...

    发表于 2006-03-29 09:16:23 5楼 让爱降临 发表于2006-03-28 20:35:06 给科普一下吧... 那么,实际的锁相放大器又是什么样的呢? 「锁相放大器」是一种什么结构的 ...

  3. 卷死我了,终于毕业了!!

    很多小伙伴都知道我今年3月份拿到了字节的前端岗位校招offer,我也立马前往去实习了.但是作为毕业生来说,还有一件天大的事必须要完成,那就是毕业论文,我本以为我可以边实习边抽空写论文,等答辩的那天请几 ...

  4. 与其这样挥霍时间,倒不如折腾折腾,尝试发展副业

    最近,全国同胞们都在密切关注着武汉的疫情.面对疫情,我们最需要做的是老老实实呆在家里,保重好自己的身体,尽量不要给国家添麻烦. 在家里闲了这么多天,很多小伙伴恐怕都有些不耐烦了,我们能做些什么呢?打游 ...

  5. SCSM 2012Orchestrator 2012 虚拟机自动交付测试

    一.前面的废话 一直以来就有在想像System Center到底能做什么.网上有一个比较早的视频,讲的是SCSM2010和Orchestrator的前身Opalis是如何实现IT运维流程管理和自动交付 ...

  6. 当效益不好的时候为什么公司选择裁员,而不是降薪

    有小伙伴对互联网行业的裁员感到困惑,认为一家真正有凝聚力的公司 一些互联网企业裁员,他们为什么不采取大家都降薪一半,不裁员,共渡时艰,这样企业文化才有力量呀? 坦白说,2018年时我的项目被裁,我也有 ...

  7. 读书笔记《人人都是产品经理》

    <人人都是产品经理>3个月前看的书,最近第二遍看的时候,做了一个详细版的读书笔记. 相比较其他产品经理的书,这本书的特点如下: 1)这真的是一本写给-1岁产品经理的书,很初级,初级到花了相 ...

  8. 为什么公司选择裁员,而不是降薪

    企业遇到难关的时候,都是如何应对的? 又到年底,又是互联网公司的传统裁员季. 每到这个时候,互联网行业总是人心惶惶,大家都担心被裁,也都担心公司的发展出了问题. 加上互联网行业中,包括在线教育和游戏都 ...

  9. Mysql Cluster 集群 windows版本

    VM1:192.168.220.102 管理节点(MGM) VM2:192.168.220.103 数据节点(NDBD1),SQL节点(SQL1) VM3:192.168.220.104 数据节点(N ...

最新文章

  1. matlab 卷积conv2用法
  2. python和对象复习_【Python复习巩固 Day4】面向对象编程
  3. 【WPF】ListBox嵌套与事件冒泡
  4. 从零开始数据科学与机器学习算法-人工神经网络与反向传播-09
  5. php无法查询mysql字母,php – 无法在Multi MYSQL查询语句中获取结果
  6. 字符串比较strcmp
  7. ios 旋转加载gif_iOS 中gif图的显示
  8. Python批量提取Excel文件中的图片
  9. 技术随笔八——仰望夜空 仰望Git
  10. Nginx 0.8.x + PHP 5.2.13(FastCGI)搭建胜过Apache十倍的Web服务器(第6版)[原创]
  11. 窗台上晒了一本书,三个人问了三个问题
  12. SPI通信协议详解(五)
  13. 实验一:交换机和集线器的工作原理
  14. 20190628 《此生,未完成》-- 于娟
  15. 我的编程之路点滴记录(五)
  16. 【FI】财务预制凭证界面隐藏过账按钮
  17. 可溶性变色配体(PCLs)-光致变色-杂环偶氮苯/螺噁嗪光致变色材料/二氧化钛溶胶凝胶光致变色材料
  18. 地使用分类数据下载介绍
  19. 东北财经计算机考研分数线,东北财经大学考研分数线_2021考研国家分数线什么时候出来...
  20. Python软件编程等级考试一级——20220915

热门文章

  1. 基于单片机的水壶自动加热系统_基于烟雾检测火灾自动报警系统
  2. 记录一下vlfeat视觉库配置
  3. E0144“const char *“ 类型的值不能用于初始化 “char *“ 类型的实体
  4. 热点账户问题和常用解决方案【上】
  5. PHP中对象的深拷贝与浅拷贝
  6. 禁止右键 巧妙破解右键被禁的方法
  7. samba mv命令出错
  8. linux 与 window 对比式理解与应用
  9. C# winform 获取当前路径
  10. 无线渗透--wifiphisher之wifi钓鱼获取wifi密码