[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>() { ...
随机推荐
- bzoj Gty的超级妹子树 块状树
Gty的超级妹子树 Time Limit: 7 Sec Memory Limit: 32 MBSubmit: 500 Solved: 122[Submit][Status][Discuss] De ...
- HTML5学习之新增标签
转自:http://www.cnblogs.com/fly_dragon/archive/2012/05/25/2516142.html 作者:FlyDragon 一.引言 在本节中,笔者将向大家讲述 ...
- es6+最佳入门实践(14)
14.模版字符串 模版字符串(template string)是增强版的字符串,定义一个模版字符串需要用到反引号 let s = `这是一个模版字符串` console.log(s) 14.1.模版字 ...
- Selenium IDE安装和检查获取的控件路径技巧
来源:http://www.jianshu.com/p/0ea2dc83549f 从学习Selenium 开始,都是自己写脚本,后来得知有个插件Selenium IDE可以录制脚本,也懒得用了,觉得自 ...
- pandas 读写sql数据库
如何从数据库中读取数据到DataFrame中? 使用pandas.io.sql模块中的sql.read_sql_query(sql_str,conn)和sql.read_sql_table(table ...
- echarts 图表建立步骤
需要引用的文件 <script src="web/mobile/js/jquery-1.8.3.min.js"></script> <script s ...
- 第六篇:远程过程调用(RPC)
Remote procedure call (RPC) 客户端接口 有关RPC的说明 回调队列 消息属性 关联的ID ( Correlation Id ) 整合 在第二篇教程中,我们学习了如何使用工作 ...
- 记录一次统计首页MYSQL非常慢的解决过程
select resource_size_int from t_resource_info where release_status in (1,3) and res_type in (1,2,4,5 ...
- 杀掉MYSQL死锁进程
vi /usr/local/killmysqlprocess.sh #!/bin/bash #*/1 * * * * /usr/local/src/killmysqlprocess.sh backdi ...
- Ajaxterm + nginx 实现一个简单的堡垒机
https://blog.csdn.net/zhang19771105/article/details/50497581 http://wuliangxx.iteye.com/blog/600113