被relativeLayout的grivate center 折腾死了
来源:互联网 发布:163邮箱 ssl smtp端口 编辑:程序博客网 时间:2024/04/29 19:54
<?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的布局效果:
0 0
- 被relativeLayout的grivate center 折腾死了
- 被wpf折腾死了
- 被编码问题折腾死了
- 折腾死了,ADO.net+MySQL
- 数组大折腾。晕死了。。。
- RelativeLayout和LinearLayout中的子控件layout_gravity="center"的问题解决
- 微软的IE9被迅雷害死了
- 被坑死了的中文乱码
- 电脑被折腾的过程
- 我的小鱼死了
- 折腾二维数组(哎,真的把自己折腾死了,虽然在做的时候错了好多地方,需要认真改错,但是看到最后的结果,真的很开心)
- 无聊死了~~被点名~~
- 被坑死了。。。
- 被Idea欺负死了
- 折腾的。。。。。
- 今天被T25 rerun的问题郁闷死了
- 被FileOutputStream的append参数搞死了……
- Pots(由于我的zz,被搞死了lol)
- Ubuntu常用命令汇总
- CodeForces 149D Coloring Brackets(区间DP)
- Asyncsocket如何把Objc的类型转成NSData类型
- iOS视频转换格式
- ok6410 3.0.1内核调用V4L接口出错,解决方法
- 被relativeLayout的grivate center 折腾死了
- 黄阶低级 - 《 Java 核心》- 3.8 控制流程 - 修改0次
- 归并排序
- 查看cloudrea的许可证---可用期限
- HDU 2126
- docker下tomcat环境搭建
- 一些东西+一些小错误。
- poj 2187 Beauty Contest (计算几何)
- 2016.08.14【初中部 NOIP提高组 】模拟赛C题解