HardBirch

【Android】getScaledTouchSlop与setCompoundDrawables 函数的说明

时间:12-12-24 栏目:android学习笔记 作者:魔豆先生 评论:0 点击: 5,997 次

一、关于ViewConfiguration.getScaledTouchSlop函数的功能

ViewConfiguration.getScaledTouchSlop () 作用:是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。

 

二、setCompoundDrawables  与 setCompoundDrawablesWithIntrinsicBounds  差别

public void  setCompoundDrawables  (Drawable left, Drawable top, Drawable right, Drawable bottom)
Since: API Level 1

Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use null if you do not want a Drawable there. The Drawables must already have had setBounds(Rect) called.

public void  setCompoundDrawablesWithIntrinsicBounds  (Drawable left, Drawable top, Drawable right, Drawable bottom)
Since: API Level 1

Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.

翻译:

做了一个测试,大概推出这样的结论:

1、setCompoundDrawables 画的drawable的宽高是按drawable.setBound()设置的宽高,所以才有The Drawables must already have had setBounds(Rect) called.这句话之说。

2、setCompoundDrawablesWithIntrinsicBounds是画的drawable的宽高是按drawable固定的宽高,即通过getIntrinsicWidth()与getIntrinsicHeight()获得,所以才有The Drawables' bounds will be set to their intrinsic bounds.这句话之说!

 

声明: 本文由( 魔豆先生 )原创编译,转载请保留链接: 【Android】getScaledTouchSlop与setCompoundDrawables 函数的说明

【Android】getScaledTouchSlop与setCompoundDrawables 函数的说明:等您坐沙发呢!

发表评论


QQ群互动

Linux系统与内核学习群:194051772

WP建站技术学习交流群:194062106

魔豆之路QR

魔豆的Linux内核之路

魔豆的Linux内核之路

优秀工程师当看优秀书籍

优秀程序员,要看优秀书!

赞助商广告

友荐云推荐