[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>() { ...
随机推荐
- 停止ambari上服务的顺序
Before performing any upgrades or uninstalling software, stop all of the Hadoop services in the foll ...
- ERROR: Found lingering reference file hdfs
Found lingering reference异常 ERROR: Found lingering reference file hdfs://jiujiang1:9000/hbase/month_ ...
- background-color和background-image问题
今天撸码的时候发现需要background-color和background-image 一起用,才开始考虑两个可不可以一起用 查阅多方资料才知道可以写成background:color url() ...
- Asp.Net Core 基于QuartzNet任务管理系统(这是一篇用来水的随笔)
之前一直想搞个后台任务管理系统,零零散散的搞到现在,也算完成了. 废话不多说,进入正题. github地址:https://github.com/YANGKANG01/QuartzNetJob 一.项 ...
- oracle中函数
一:前言 最近决定每天都把知识点总结下,然后每个星期把知识点在进行分类发表日志. 二:The Question (1):在oracle中进行年龄的计算,知道出生日期进行计算后截取,本来是一个很简单的函 ...
- MyEclipse中代码提醒功能
一:最近仔细研究了下spring mvc中的代码,自己在配置文件哪里来时出现问题,没有提醒,只好自己搜了下有关的信息.如下 window--->preferences---->java-- ...
- MySql数据库学习总结(MySQL入门到精通)
2017.1.24-2.3日(在大兴实验室) 1.数据库存储引擎: (1)MyISAM: 访问速度快,对事物完整性没要求,并以访问为主的适合这个 (2)InnoDB: 更占磁盘空间,需要进行频繁的更新 ...
- [POI2014] KUR-Couriers(洛谷P3567)
洛谷题目链接:[POI2014]KUR-Couriers 题目描述 Byteasar works for the BAJ company, which sells computer games. Th ...
- windows启动redis服务
参考:https://www.cnblogs.com/M-LittleBird/p/5902850.html 使用python的pip install redis以后还需要下载安装redis安装文件才 ...
- python3 面向对象、类、继承、组合、派生、接口、子类重用父类方法
对象是特征(变量)与技能(函数)的结合体而类是一系列对象共同的特征与技能的集合体 class teacher: lesson = "python" def __init__(sel ...