android setCompoundDrawables和setCompoundDrawablesWithIntrinsicBounds区别
手工设置文本与图片相对位置时,常用到如下方法:
setCompoundDrawables(left, top, right, bottom)
setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom)
意思是设置Drawable显示在text的左、上、右、下位置。
但是两者有些区别:
setCompoundDrawables 画的drawable的宽高是按drawable.setBound()设置的宽高,
所以才有The Drawables must already have had setBounds(Rect) called.
使用之前必须使用Drawable.setBounds设置Drawable的长宽。
setCompoundDrawablesWithIntrinsicBounds是画的drawable的宽高是按drawable固定的宽高,
所以才有The Drawables' bounds will be set to their intrinsic bounds.
即通过getIntrinsicWidth()与getIntrinsicHeight()获得,
android setCompoundDrawables和setCompoundDrawablesWithIntrinsicBounds区别的更多相关文章
- android setCompoundDrawables和setCompoundDrawablesWithIntrinsicBounds差别
手工设置文本与图片相对位置时.经常使用到例如以下方法: setCompoundDrawables(left, top, right, bottom) setCompoundDrawablesWithI ...
- android:id="@+id/button1" 与 android:id="@id/button1" 区别 @string
一.android:id="@+id/button1" 与 android:id="@id/button1" 区别 android:id="@+id/ ...
- Android @id和@+id区别
Android中的组件需要用一个int类型的id属性值来表示.id属性只能接受资源类型的值,也就是必须以@开头的值,例如,@id/abc.@+id/xyz等.如果在@后面使用“+”,表示当修改完某个布 ...
- android.support.v4.app.Fragment vs android.app.Fragment 的区别
android.support.v4.app.Fragment vs android.app.Fragment 的区别 我开过平板相关应用,用了Fragment来处理.后来重新开发另外一个应用,直接引 ...
- 经典软件测试面试题目:Android 和 ios 测试区别?这样回答:稳!
Android 和 ios 测试区别? App 测试中 ios 和 Android 有哪些区别呢?1.Android 长按 home 键呼出应用列表和切换应用,然后右滑则终止应用:2.多分辨率测试, ...
- android Thread和Runable区别,精讲(有疑问)
网上总是说Runable和Thread可以实现线程,这导致我对Thread和Runable有错误的理解,谁让当时不求甚解,让我一直以为实现Runable可以开启线程. 看过源码后进行区分这两者. 无论 ...
- 【转】Android onTouch()和onTouchEvent()区别
1.onTouch()方法: onTouch方式是View的OnTouchListener接口中定义的方法. 当一个View绑定了OnTouchListener后,当有Touch事件触发时,就会调用o ...
- android:layout_alignleft layout_toleftof区别,详解RelativeLayout布局属性
转载请注明博客地址. 最近看博客看到有关于RelativeLayout布局的解释,有的解释很多是错误的.因此有必要对每一个常见的布局属性进行描述.以下解释全部都是逐行进行测试的. 首先把常用的布局分组 ...
- Android Studio 版本间区别
2.3.2 ->3.0.1 Gradle版本为4.1 com.android.tools.build:gradle:3.0.x Android Monitor 被换成了 Android P ...
随机推荐
- Vivado寄存器初始值问题
前言 本复位只针对Vivado中的寄存器复位. 什么时候需要复位?到底要不要复位?怎么复位?复位有什么卵用? 该复位的寄存器需要复位,复位使得寄存器恢复初始值,有的寄存器并不需要复位(数据流路径上). ...
- xadmin 组件拓展自定义使用
xadmin 组件相关可选自定义字段 list_display 功能 设置默认的显示字段(列) 配置 list_display = ['name', 'desc', 'detail', 'degree ...
- Magento 2 Plugin - Interceptor - Magento 2插件 - 拦截器-插件开发
Magento 2 Plugin - Interceptor - Magento 2插件 - 拦截器 Magento 2 Plugin is a technical plugin for your b ...
- CQOI2018异或序列 [莫队]
莫队板子 用于复习 #include <cstdio> #include <cstdlib> #include <algorithm> #include <c ...
- css布局:左边定宽、右边自适应
方法一 : 左边 左浮动,右边 margin-left *{margin: 0;padding: 0;} .left{ float: left; width: 200px; border: 1px s ...
- 读zepto源码之工具函数
读zepto源码之工具函数 Zepto 提供了丰富的工具函数,下面来一一解读. 源码版本 本文阅读的源码为 zepto1.2.0 $.extend $.extend 方法可以用来扩展目标对象的属性.目 ...
- go 的匿名函数和闭包
匿名函数 匿名函数是指不需要定义函数名的一种函数实现方式. 在Go语言中,函数可以像普通变量一样被传递或使用,这与C语言的回调函数比较类似.不同的是,Go语言支持随时在代码里定义匿名函数. 匿名函数由 ...
- Entity Framework入门教程(3)---EF中的上下文简介
1.DbContext(上下文类) 在DbFirst模式中,我们添加一个EDM(Entity Data Model)后会自动生成一个.edmx文件,这个文件中包含一个继承DbContext类的上下文实 ...
- 库增删该查,表增删该查,记录增删该查,表与表关系(多对多,多对一,一对一),mysql用户管理
库增删该查 增加库 create database db1 create database db1 charset="gbk 查看库 show databases 查看所有库 show cr ...
- GMM与EM共舞
GMM,即高斯混合模型(Gaussian Mixture Model),简单地讲,就是将多个高斯模型混合起来,作为一个新的模型,这样就可以综合运用多模型的表达能力.EM,指的是均值最大化算法(expe ...