特别注意,如果要是

android:layout_alignTop="@id/bind_decode_item_layout"

android:layout_centerHorizontal="true" 生效
必须要设置兄弟元素android:layout_centerInParent="true"


<?xml version="1.0" encoding="utf-8"?>
<com.whoop.mobile.trace.view.BindDecodeItemLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" > <RelativeLayout
android:id="@+id/bind_decode_item_layout"
android:layout_width="180dp"
android:layout_height="220dp"
android:layout_centerInParent="true"

android:gravity="center" > <ImageView
android:id="@+id/bind_decode_item_layout_diagram"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/bind_decode_item" /> <TextView
android:id="@+id/bind_decode_item_layout_qrcode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:ellipsize="end"
android:gravity="center_horizontal"
android:singleLine="true"
android:textColor="@color/black"
android:textSize="15sp" />
</RelativeLayout> <ImageButton
android:id="@+id/bind_decode_item_layout_btnDelete"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="-25dp"
android:layout_alignTop="@id/bind_decode_item_layout"

android:layout_centerHorizontal="true"

android:scaleType="centerCrop"
android:src="@drawable/activity_sale_duplicate_icon" /> </com.whoop.mobile.trace.view.BindDecodeItemLayout>

Android RelativeLayout 布局android:layout_centerHorizontal="true"注意的更多相关文章

  1. Android——android相对布局(RelativeLayout)及属性

    RelativeLayout布局 android:layout_marginTop="25dip" //顶部距离 android:gravity="left" ...

  2. android 相对布局

    RelativeLayout布局 android:layout_marginTop="25dip" //顶部距离 android:gravity="left" ...

  3. android layout 布局属性

    控件属性: android属性 Android功能强大,界面华丽,但是众多的布局属性就害苦了开发者,下面这篇文章结合了网上不少资料, 第一类:属性值为true或false android:layout ...

  4. Android知识补充(Android学习笔记)

    Android知识补充 ●国际化 所谓的国际化,就是指软件在开发时就应该具备支持多种语言和地区的功能,也就是说开发的软件能同时应对不同国家和地区的用户访问,并针对不同国家和地区的用户,提供相应的.符合 ...

  5. android 基本布局(RelativeLayout、TableLayout等)使用方法及各种属性

        本文介绍 Android 界面开发中最基本的四种布局LinearLayout.RelativeLayout.FrameLayout.TableLayout 的使用方法及这四种布局中常用的属性. ...

  6. Android相对布局(RelativeLayout)

    Android相对布局(RelativeLayout) 备注:这里的视图和元素是等同的概念. RelativeLayout是一个允许子视图相对于其他兄弟视图或是父视图显示的视图组(通过ID指定).每个 ...

  7. Android 五大布局(LinearLayout、FrameLayout、AbsoulteLayout、RelativeLayout、TableLayout )

    前言          欢迎大家我分享和推荐好用的代码段~~ 声明          欢迎转载,但请保留文章原始出处:          CSDN:http://www.csdn.net        ...

  8. Android开发之布局--RelativeLayout布局

    RelativeLayout 相对布局 true或false属性 Layout_centerHorizontal   当控件位于父控件的横向中间位置 Layout_centerVertical   当 ...

  9. android:layout_alignleft layout_toleftof区别,详解RelativeLayout布局属性

    转载请注明博客地址. 最近看博客看到有关于RelativeLayout布局的解释,有的解释很多是错误的.因此有必要对每一个常见的布局属性进行描述.以下解释全部都是逐行进行测试的. 首先把常用的布局分组 ...

随机推荐

  1. php学习小技巧

    1.print_r可打印数组 <?php echo '<p class="ajax">This paragraph was loaded with AJAX.&l ...

  2. centos安装nodejs和mongodb

    安装nodejs: Run as root on RHEL, CentOS or Fedora, for Node.js v4 LTS Argon: curl --silent --location ...

  3. 代码bug

    1.webstorm ide未配置basePath本地会加入根路径 2.点击一次就销毁可以给标签设置一个值data-val="0" 某个函数只执行一次的方法,或者也可以考虑绑用on ...

  4. [jQuery编程挑战]007 切换数据表格的行列

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8&quo ...

  5. jquery 获取元素的 实际宽度和高度

    jquery outerHeight方法 outerWidth方法 转: http://www.cnblogs.com/zhja/archive/2012/11/07/2758665.html jqu ...

  6. Bootstrap 和 LESS

    Bootstrap 简介 什么是 Bootstrap? Bootstrap 是一个用于快速开发 Web 应用程序和网站的前端框架.Bootstrap 是基于 HTML.CSS.JAVASCRIPT 的 ...

  7. 关于SQL server的一些知识点

    关于怎么打开xp_cmdshell的方法: exec sp_configure 'show advanced option',1reconfiguregoexec sp_configure 'xp_c ...

  8. const 笔记

    .指向const的指针例如:double a=1.01;const double * b=&a;*b=2.1; //这显然是错误的a=2.1; //这是正确的,a和*b的值都会变成2.01,有 ...

  9. hadoop hdfs 命令行 设置文件夹大小的上限 quota:配额

    >bin/hdfs dfs -put readme.txt /finance >bin/hdfs dfs -du -s /finance > /finance >bin/hdf ...

  10. BZOJ 3893 Cow Jog

    Description The cows are out exercising their hooves again! There are \(N\) cows jogging on an infin ...