图片文字居中显示

**①组件TextView的属性 drawableTop

```

    <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_10"
>
<TextView
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:drawableTop="@mipmap/xinyongxinxichaxun"
android:layout_weight="1"
android:text="不查征信"
android:textSize="@dimen/dp_11"
android:textColor="@color/gray9"
android:gravity="center"
/>
<TextView
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:drawableTop="@mipmap/biangengshoujihao"
android:layout_weight="1"
android:text="手机号借款"
android:textSize="@dimen/dp_11"
android:textColor="@color/gray9"
android:gravity="center"
/>
<TextView
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:drawableTop="@mipmap/vip"
android:layout_weight="1"
android:text="高通过率"
android:textSize="@dimen/dp_11"
android:textColor="@color/gray9"
android:gravity="center"
/>
<TextView
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:drawableTop="@mipmap/zhimafen"
android:layout_weight="1"
android:text="芝麻分550"
android:textSize="@dimen/dp_11"
android:textColor="@color/gray9"
android:gravity="center"
/>
<TextView
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:drawableTop="@mipmap/shinshopxinpin"
android:layout_weight="1"
android:text="今日新品"
android:textSize="@dimen/dp_11"
android:textColor="@color/gray9"
android:gravity="center"
/>
</LinearLayout>

```

显示的效果如下图所示:

[Android]Android 布局中如何让图片和文字居中显示?的更多相关文章

  1. android:scaleType 布局文件加载图片时候的显示方式

    android:scaleType="center" 以原图的几何中心点和ImagView的几何中心点为基准,按图片的原来size居中显示,不缩放,当图片长/宽超过View的长/宽 ...

  2. 【css对齐】块内或者行内图片与文字居中对齐最靠谱的方式!

    块内或者行内图片与文字居中对齐最靠谱的方式! 做图片与文字在一行的按钮时候最常用到,总结了一个靠谱的方法,终于可以完美的对齐下面给个代码 首先是html: <p class="btnU ...

  3. (Android UI)Android应用程序中资源:图片、字符串、颜色、布局等

    Android系统设计采用代码和布局分离的设计模式,因此在设计Android应用程序时需要遵循该设计模式. “把非代码资源(如图片和字符串常量)和代码分离开来始终是一种很好的做法.”---<An ...

  4. 【Android】安卓中常用的图片加载方法

    一.通过相机选图片: 布局文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout x ...

  5. 从零开始学android开发-布局中 layout_gravity、gravity、orientation、layout_weight

    线性布局中,有 4 个及其重要的参数,直接决定元素的布局和位置,这四个参数是 android:layout_gravity ( 是本元素相对于父元素的重力方向 ) android:gravity (是 ...

  6. android 在布局中动态添加控件

    第一步 final LayoutInflater inflater = LayoutInflater.from(this); 第二步:获取需要被添加控件的布局 final LinearLayout l ...

  7. Winform DataGridView列的单元格中动态添加图片和文字

    先上图在说,第二列中图片和文字的样式 1.需要重写DataGridViewTextBoxColumn,新建类TextAndImageColumn.cs using System; using Syst ...

  8. 在QTableWidget中添加QCheckBox并使其居中显示(转)

    实现思路:把QCheckBox嵌入式到一个水平布局中 QWidget *widget;   QHBoxLayout *hLayout;   QCheckBox *ckb;   ...   ckb =  ...

  9. 69、Android 布局中轻松实现图片的全屏、居中、平铺

    public void paint() { if (item.laying_mode != 1)//平铺或者充满 { new AsyncTask<Void, Void, Void>() { ...

随机推荐

  1. visio2013安装提示找不到Office.zh_cn\officeMUI.mis officemui.xml(转)

    windoes10 已经安装office2013后,想安装Visio2013,报错如题所示.解决方法我采用的是方法二:解压缩office2013的ISO包,解压缩Visio2013的ISO包,安装Vi ...

  2. 两数之和 [ leetcode ]

    原题地址:https://leetcode-cn.com/articles/two-sum/ 给定一个整数数组和一个目标值,找出数组中和为目标值的两个数. 你可以假设每个输入只对应一种答案,且同样的元 ...

  3. 7月19日day11总结

    今天学习过程和小结 上午进行测试复习了 1,hdfs中namenode和datanode作用 2,hdfs副本存放机制 3,mapreduce计算处理过程 4,格式化hdfs命令 5,hdfs的核心配 ...

  4. Spring学习之路——单例模式和多例模式

    在Spring中,bean可以被定义为两种模式:prototype(多例)和singleton(单例) singleton(单例):只有一个共享的实例存在,所有对这个bean的请求都会返回这个唯一的实 ...

  5. bzoj2683/4066 简单题

    传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2683 http://www.lydsy.com/JudgeOnline/problem.ph ...

  6. [BZOJ3238][Ahoi2013]差异解题报告|后缀数组

    Description 先分析一下题目,我们显然可以直接算出sigma(len[Ti]+len[Tj])的值=(n-1)*n*(n+1)/2 接着就要去算这个字符串中所有后缀的两两最长公共前缀总和 首 ...

  7. 【BZOJ】1604: [Usaco2008 Open]Cow Neighborhoods 奶牛的邻居

    [算法]并查集+平衡树+数学+扫描线 [题解] 经典曼哈顿距离转切比雪夫距离. 曼哈顿距离:S=|x1-x2|+|y1-y2|<=c 即:max(x1-x2+y1-y2,x1-x2-y1+y2, ...

  8. MyBatis系列三 之 使用getMapper剔除掉Dao的实现类

    MyBatis系列三  之  使用getMapper剔除掉Dao的实现类 我们在系列一 中 我们使用的是Dao的实现类   来操作底层数据库,今天我们使用getMapper()来替换Dao的实现类, ...

  9. Java相关框架

    框架 类型 设计(个人理解) HK2 自动注入框架 Jersey RESTful Jetty HTTP服务 Retrofit HTTP客户端 ActiveMQ 消息组件 主题.队列 Redis K-V ...

  10. requests上传文件

    """ requests上传文件时,如果文件名是中文,会导致上传失败,参考:https://www.cnblogs.com/liaofeifight/p/5807901. ...