原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>  

更多相关文章

  1. android2.2 2.3状态栏区别
  2. Android第三方文件选择器aFileChooser使用方法详解
  3. 实现Android多张图片选择
  4. Android(安卓)Studio常用快捷键、Android(安卓)Studio快捷键大全
  5. android studio常用快捷键整理
  6. Android代码内存优化建议-Android官方篇
  7. android数据库——SQLiteDatabase的Helper类
  8. Bluetooth in Android(安卓)4.2 and 4.3(一):综述
  9. Android(安卓)Canvas练习(8)自已绘环形图(Dount Chart)

随机推荐

  1. android设置背景平铺
  2. [Android Pro] 使用CursorLoader异步加载
  3. Android中的sdk相关介绍
  4. android 网络通信(一)
  5. ionic3修改android安装显示的名称
  6. Android代码混淆常见配置
  7. Android 自定义dialog出入场动画
  8. android自动更新程序,安装完以后就什么都
  9. Android 扩展屏幕 实现主屏副屏同步或者
  10. Android的网络与通信