<?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. 被这个C程序折腾死了

    The C programming language 的第13页,1.5.3 行计数的那里,那个统计换行符个数的程序我好像无法运行,无论输入什么,按多少下enter,什么都出不来. #include& ...

  2. 微信小程序开发心得

    微信小程序也已出来有一段时间了,最近写了几款微信小程序项目,今天来说说感受. 首先开发一款微信小程序,最主要的就是针对于公司来运营的,因为,在申请appid(微信小程序ID号)时候,需要填写相关的公司 ...

  3. [开源].NET高性能框架Chloe.ORM-完美支持.NET Core

    扯淡 这是一款轻量.高效的.NET C#数据库访问框架(ORM).查询接口借鉴 Linq(但不支持 Linq).借助 lambda 表达式,可以完全用面向对象的方式就能轻松执行多表连接查询.分组查询. ...

  4. Red Hat Enterprise Server 6.0 安装Sendmail相关包

    由于需要在Linux服务器(Red Hat Enterprise Linux Server release 6.0)上配置邮件服务,需要安装Sendmail包,一般Sendmail的安装有两种方式:R ...

  5. Fast RCNN 训练自己数据集 (2修改数据读取接口)

    Fast RCNN训练自己的数据集 (2修改读写接口) 转载请注明出处,楼燚(yì)航的blog,http://www.cnblogs.com/louyihang-loves-baiyan/ http ...

  6. 条件编译#if #ifdef

    近期由于一些莫名其妙的原因开始学c++,我觉得我哪天要是挂了也是被自己给折腾死的,算了,反正不是折腾死就是被淘汰,当是没事打发时间了,废话不多说,开始今天的主题. 之前接触的注释就是注释,条件语句就是 ...

  7. VS Code 开发asp.net core 遇到的坑

    摘要 微软发布.NET Core 1.0,ASP.NET Core 1.0 与 Entity Framewok 1.0也有一段时间了,一直没进行这方面的学习,节前公司让调研这方面的可行性.所以还是从最 ...

  8. 使用mvvm框架avalon开发公司内部运营管理系统的一些心得

    接触avalon差不多有一年时间了,当时是看前端大牛司徒正美的博客才了解到还有这么一个高大上的玩意,然后就加入了avalon的讨论群.从群里零零散散的了解了avalon的一些特性,感觉很强大,感觉思想 ...

  9. 解决Eclipse里Maven工程报 An error occurred while filtering resources错误

    这几天被maven的单元测试折腾死了,以为是自己的eclipse有问题呢,今天早上来了又发现eclipse报了一个很奇怪的错误:An error occurred while filtering re ...

随机推荐

  1. Azure 进阶攻略 | 文件完整性,你打算如何证明?

    假设你是一位独立软件开发者,通过自己的网站提供软件下载.网站完全托管在 Azure 中,并且软件下载也是通过 Azure Blob 存储和 Azure CDN 服务提供的. 这做法真不错,不需要自己管 ...

  2. OMD开源监控软件

    参考 Best Monitoring Solution - OMD (Nagios + Check_MK) 官网 mathias-kettner.com OMD labs.consol.de Conf ...

  3. redis笔记(一)

    redis安装 ubuntu:     apt-get install redis-server redis服务  :redis-server 启动客户端   :redis-cli redis简单知识 ...

  4. Scikit Learn

    Scikit Learn Scikit-Learn简称sklearn,基于 Python 语言的,简单高效的数据挖掘和数据分析工具,建立在 NumPy,SciPy 和 matplotlib 上.

  5. 页面dom事件防止失效的一种写法

    经常我们写事件是这样的 $('.day').on('click', function () { some(); }); 但是这样在spa模式下经常容易出现页面切换后事件失效的问题, 可以采用这样的写法 ...

  6. 2019.03.16 ZJOI2019模拟赛 解题报告

    得分: \(100+27+20=147\)(\(T1\)巨水,\(T2,T3\)只能写暴力分) \(T1\):深邃 比较套路的一眼题,显然是一个二分+贪心,感觉就是\(NOIP2018Day1T3\) ...

  7. eclipse的一些快捷键

    ctrl + 1快速修复 ctrl + d 快速删除 ctrl + F11快速运行 ctrl + m 放大工作区 atl + /注释 ...

  8. 【转】如何手动添加Android Dependencies包

    在ADT16 之前可以在工程里面做关联,eclipse会在工程上自动添加ReferenceLibrary.新版本的ADT修改了第三方jar的导入方式,只需要在工程目录下新建libs文件夹,注意是lib ...

  9. iterm2配置项

    1. 启动终端Terminal2. 进入当前用户的home目录    输入cd ~3. 创建.bash_profile    输入touch .bash_profile 在导入并应用完颜色方案之后,通 ...

  10. mac 开机白屏,卡进度条,无法进入系统

    几个月前我的老Mac又一次的坏掉了,现在想起来就记录一下,哎,话说Apple的东西吧,好用是好用,一般都不会坏,质量保证,但是如果一旦坏了,那就是大问题!(坏了第一时间就应该打电话给apple客服小姐 ...