解决android:layout_marginBottom在RelativeLayout中无效的bug
来源:互联网 发布:搜索引擎源码 编辑:程序博客网 时间:2024/06/14 07:09
原xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/iv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="15dp"/> </RelativeLayout>
以上代码中android:layout_marginBottom=”15dp”是没有作用的,原因是在ImageView下,已经没有任何View了,所以导致了android:layout_marginBottom失效了。
解决方法:
在ImageView底部加入一个空的View,然后设置ImageView在此View之上即可。
代码如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/iv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/view_none" android:layout_marginBottom="15dp"/> <View android:id="@+id/view_none" android:layout_width="0px" android:layout_height="0px" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" /> </RelativeLayout>
0 0
- 解决android:layout_marginBottom在RelativeLayout中无效的bug
- 解决android:layout_marginBottom在RelativeLayout中无效的问题
- 解决android:layout_marginBottom在RelativeLayout中无效的问题
- [Android]RelativeLayout中最底的View其layout_marginBottom无效
- Android RelativeLayout中layout_marginBottom失效
- ListView的item中RelativeLayout内view的layout_marginBottom无效的问题
- 【Android】解决在RelativeLayout中使用ImageView, adjustViewBounds 无效
- Android的RelativeLayout的view的layout_marginBottom不起作用
- Android的RelativeLayout的view的layout_marginBottom不起作用
- Android的RelativeLayout的view的layout_marginBottom不起作用
- [bug]android中ScrollView内部控件match_parent无效的解决!
- Android相对布局 layout_marginBottom无效
- android中android:layout_marginBottom的不起作用问题
- 解决Android Checkbox Padding无效的Bug
- RelativeLayout的layout_marginBottom属性失效问题
- RelativeLayout的layout_marginBottom属性失效问题
- layout_marginBottom无效
- ListView 中RelativeLayout 布局的 android:layout_above 无效的解决办法
- poj 3692 最大团(二分图匹配,最大独立集)
- C++_运算符重载
- 【转】ssh scp 免密码方法
- 依靠NSOutputStream,NSURLSession,NSURLSessionDataTask创建一个支持断点下载的任务
- Http和Https的区别
- 解决android:layout_marginBottom在RelativeLayout中无效的bug
- HTML第一课:B/S结构&C/S结构、HTML、六种常用标签
- 【CodeVS 1477】 永无乡 |Splay
- android Fragment中遇到的问题
- Struts的基本概念
- 高分辨率屏幕下有哪些windows系统界面是模糊的
- 1808: [Ioi2007]training 训练路径|树形DP
- 蓝牙模块
- http://blog.csdn.net/jiangwei0910410003/article/details/41620363