[Android]Android 布局中如何让图片和文字居中显示?
图片文字居中显示
**①组件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 布局中如何让图片和文字居中显示?的更多相关文章
- android:scaleType 布局文件加载图片时候的显示方式
android:scaleType="center" 以原图的几何中心点和ImagView的几何中心点为基准,按图片的原来size居中显示,不缩放,当图片长/宽超过View的长/宽 ...
- 【css对齐】块内或者行内图片与文字居中对齐最靠谱的方式!
块内或者行内图片与文字居中对齐最靠谱的方式! 做图片与文字在一行的按钮时候最常用到,总结了一个靠谱的方法,终于可以完美的对齐下面给个代码 首先是html: <p class="btnU ...
- (Android UI)Android应用程序中资源:图片、字符串、颜色、布局等
Android系统设计采用代码和布局分离的设计模式,因此在设计Android应用程序时需要遵循该设计模式. “把非代码资源(如图片和字符串常量)和代码分离开来始终是一种很好的做法.”---<An ...
- 【Android】安卓中常用的图片加载方法
一.通过相机选图片: 布局文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout x ...
- 从零开始学android开发-布局中 layout_gravity、gravity、orientation、layout_weight
线性布局中,有 4 个及其重要的参数,直接决定元素的布局和位置,这四个参数是 android:layout_gravity ( 是本元素相对于父元素的重力方向 ) android:gravity (是 ...
- android 在布局中动态添加控件
第一步 final LayoutInflater inflater = LayoutInflater.from(this); 第二步:获取需要被添加控件的布局 final LinearLayout l ...
- Winform DataGridView列的单元格中动态添加图片和文字
先上图在说,第二列中图片和文字的样式 1.需要重写DataGridViewTextBoxColumn,新建类TextAndImageColumn.cs using System; using Syst ...
- 在QTableWidget中添加QCheckBox并使其居中显示(转)
实现思路:把QCheckBox嵌入式到一个水平布局中 QWidget *widget; QHBoxLayout *hLayout; QCheckBox *ckb; ... ckb = ...
- 69、Android 布局中轻松实现图片的全屏、居中、平铺
public void paint() { if (item.laying_mode != 1)//平铺或者充满 { new AsyncTask<Void, Void, Void>() { ...
随机推荐
- webpack 的第三方库分离并持久化缓存
我们常常需要在浏览器缓存一些稳定的资源,如第三方库等.要达到这个目标,只需要两步: 1.提取出“稳定的资源”: 2.提供稳定的文件hash . 处理后的出的文件就像这样子: app.1w3ad4q4. ...
- 'express' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
新安装了express,但是当查看版本号输入: express -v 时出现如下错误: 网上查找了相关资料才发现express查看版本 的命令是 express -V (即V大写) 再次尝试: 发现同 ...
- java.lang.NumberFormatException: For input string: "26.0"
数据类型转化的时候的错误: 程序中要转的字符串不是一个数字,所以在format成数字的时候就出错了. 字符串不符合数字预定格式.
- NET中IL理解(转)
.NET CLR 和 Java VM 都是堆叠式虚拟机器(Stack-Based VM),也就是說,它們的指令集(Instruction Set)都是採用堆叠运算的方式:执行时的资料都是先放在堆叠中, ...
- HDU2057
http://acm.hdu.edu.cn/showproblem.php?pid=2057 涉及到16进制内的加法,可以用%I64x直接来处理,要注意到16进制中负数是用补码来表示的.一个比较困惑的 ...
- JVM内存模型 二
在并发编程中,多个线程之间采取什么机制进行通信(信息交换),什么机制进行数据的同步? 在Java语言中,采用的是共享内存模型来实现多线程之间的信息交换和数据同步的. 线程之间通过共享程序公共的状态,通 ...
- codevs1245最小的N个和 小根堆
这道题 将b排序一下 将a(i~n)和b1加起来入堆 每次出一次队(ax+bi) 将(ax+bi+1)入队就好了 能保证答案的正确性 找个自己证明吧 #include<cstdio> #i ...
- [POJ2774]Long Long Message 解题报告
Long Long Message Description The little cat is majoring in physics in the capital of Byterland. A p ...
- CentOS 7 安装python3.6.1
说明:CentOS 7最小化安装,默认Python 2.7 ,开发需要安装python3.6.1 . 1.检查python版本 [root@bogon ~]# python -VPython 2.7. ...
- 如何让footer一直在网页底部(不使用绝对定位并且网页不论长度多长)
html: <html> <head> <link rel="stylesheet" href="layout.css" ... ...