为什么有时候像android:layout_marginBottom等变量的赋值为负数?

例如如下代码:

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout
  android:orientation="vertical"
  android:id="@id/Widget_2X4_frame"
  android:layout_width="fill_parent"
  android:layout_height="228.0dip"
  android:layout_marginTop="10.0dip"
  xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
  android:layout_width="fill_parent"
  android:layout_height="46.0dip"
  android:layout_marginBottom="-1.0dip"
  android:src="@drawable/widget_header" />
<include layout="@layout/widget_top" />
<include layout="@layout/widget_bottom" />
</LinearLayout>

解答:marginBottom 正值是 增大 与下面空间的距离,负值为减少距离。

比如你的设备分辨率是480x800,里面放个TextView marginTop是-50dip,那么你的textView就会显示到有限显示范围的距离最上面50dip的位置,在你的设备上你是看不到的。View把它存在了一个栈序列内。

最新文章

  1. linux命令grep及正则表达式
  2. PHPStorm XDebug的安装
  3. C++中 vector(容器)的用法
  4. &#39;++&#39; needs l-value
  5. BIEE修改图片步骤:修改BANNER
  6. Html、Css-----当有文字和图片的时候,需要文字和图片居中,怎么实现?不想文字换行怎么设置
  7. 自动生成XML反序列化的类
  8. mysql用户权限分配及主从同步复制
  9. uml系列(八)——部署图与构件图
  10. android学习1——LinearLayout
  11. 斗牛app上架应用宝、牛牛手机游戏推广、百人牛牛app应用开发、棋牌游戏上传、手游APP优化
  12. dnmp(docker的lnmp)安装WordPress之后图片上传问题 问题:图片上传大小问题解决和 报错413 Request Entity Too Large
  13. GoGland 快捷键说明
  14. 创建一个目录的软连接ln -s和打印当前目录pwd的一个知识点
  15. zoj 3460 二分+二分图匹配
  16. HDU 5253 连接的管道(Kruskal算法求解MST)
  17. Java7的新特性
  18. Python——内置函数(待完善)
  19. 【React】初识React
  20. cucumber &amp; selenium &amp; bddtest

热门文章

  1. POJ 2390
  2. POJ 1126
  3. iis 如何设置http访问转向https
  4. Ubuntu链接库查找
  5. centos7防暴力破解五种方法
  6. Mac 硬盘中各个文件夹详解
  7. Leetcode 647. Palindromic Substrings
  8. ADB故障时的一些命令
  9. onkeydown事件
  10. rails中常用的插件