解决android:layout_marginBottom在RelativeLayout中无效的问题
页面布局遇到一个奇怪现象,在RelativeLayout 时最下面的 一个view 设置的layout_marginBottom 在小米手机显示正常,在三星,华为设置的距离就变为 0 了。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"><ImageView android:id="@+id/img"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginBottom="30dp"/>
</RelativeLayout>
大概如下,也就是在一些手机上显示 没有距离底部30dp的效果。
解决办法就是在 最后布局下面再添加一个View。代码如下
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"><pre name="code" class="java"><ImageView android:id="@+id/img"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginBottom="30dp"/>
<View android:layout_width="0px"android:layout_height="0px"android:layout_below="@+id/img"/></RelativeLayout>
解决android:layout_marginBottom在RelativeLayout中无效的问题相关推荐
- 解决Android Studio安装过程中“SDK tools directory is missing”的问题
解决Android Studio安装过程中"SDK tools directory is missing"的问题 参考文章: (1)解决Android Studio安装过程中&qu ...
- android微信电话锁屏,解决 Android 7.0 系统中,微信无法在锁屏画面显示
文章版块:HTC One A9 在 Android 7.0 系统中htc手机微信怎么截屏htc手机微信怎么截屏,会出现微信无法在锁屏画面显示的状况.建议您进行下面修改就可以解决: 进入"HT ...
- 解决Android Studio 的AVD中的模拟器不能用PC键盘输入的问题
比较少用到模拟器,今天用来测试一些东西,但是发现使用pc的键盘输入不了文字,只能点模拟器上的虚拟键盘才能输入文字,很慢很蛋疼,于是去百度寻求解决方法,发现几乎都是以前Eclipse时代老的AVD版本的 ...
- 解决Android Studio使用过程中虚拟机无响应,无法关机:
先关闭虚拟机(若无法关闭,可直接退出Android Studio在进入),在冷启动,点击如下所示选项
- android:layout_marginbottom,为什么RelativeLayout的marginBottom和marginRight无法使用
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 界面代码: xmlns:android="http://schemas.android.com/apk/res/android" an ...
- android:layout_marginbottom=,[Android]RelativeLayout中最底的View其layout_marginBottom无效 | 学步园...
处理一个Dialog,发现RelativeLayout布局下最后一个View的layout_marginBottom会失效. 效果图见: 解决方法为: 在最底的组件后面再加个View吧... 这个现象 ...
- android:layout_marginbottom,解决relativelayout下android:marginbottom无效
android:id="@+id/relativeLayout1″ android:layout_width="match_parent" android:layout_ ...
- Android RelativeLayout中layout_marginBottom失效
问题描述: 最近遇到一个诡异的问题,在自定义Dialog时,使用自己的xml布局. 发现显示异常,如图: 布局代码如下: <RelativeLayout xmlns:android=" ...
- 特殊问题:RelativeLayout中的最后一个控件的layout_marginBottom无效的问题
出现此问题的前提是:在ViewPager+fragment实现的页面切换,在其中一个fragment的布局中,根布局是RelativeLayout: 解决方式:按照网上所说的方法在最后添加一个宽高为0 ...
最新文章
- 青海省计算机应用能力考试,青海省2015年职称计算机应用能力考试西宁考区四月份考试安排通知...
- Prioritize your work by your title
- java的this_java的this是什么意思
- Android左右声道控制软件,Android左右声道的控制
- 为什么Mac source ~/.bash_profile只生效一次(macOS Catalina)
- 用html做qq会员页面导航,untitledQQ会员页面导航3.html
- 乐鑫esp8266的串口通讯驱动源文件,nonos和rtos版本
- 《DSP using MATLAB》示例Example4.6
- java池_java中的各种池
- gFTP不能显示中文文件(夹)名的解决方法
- Isight做MATLAB优化,iSight结构优化基础16讲-学会使用isight控制ABAQUS、APDL等CAE软件...
- 幼儿识字软件测试自学,十大儿童识字APP排行,看看有你知道的吗?
- 不知道rar压缩包密码可以解密么,rar压缩包有密码怎么解开?
- python里的百分号_python里百分号什么意思
- 国标 计算机房 湿度,数据中心机房:温度、湿度标准是什么?
- C语言编程>第二十二周 ④ 从键盘输入一组小写字母,保存在字符数组str中,请补充fun函数,该函数的功能是:把字符数组str中字符下标为偶数的小写字母转换成对应的大写字母,结果仍保存在原数组
- “云”溪笔谈 | VR——看得见的未来
- matlab求最大公倍数_matlab求最大公约数和最小公倍数
- “大力神”正式由欧派接管
- 项目管理工具dhtmlxGantt甘特图入门教程(十五):从MS项目导入/导出(上)