AutoLua2AutoLua2
  • 快速开始
  • 介绍
  • 自动化API

    • 图色相关
    • 模拟相关
    • 节点相关
    • 界面相关
    • 其他
  • 界面API
  • 快速开始
  • 介绍
  • 自动化API

    • 图色相关
    • 模拟相关
    • 节点相关
    • 界面相关
    • 其他
  • 界面API
  • 自动化API

    • 图色相关

      • 全局
      • Bitmap
      • FindOrder
    • 模拟相关

      • 全局
      • Pointer
      • KeyCode
    • 节点相关

      • 全局
      • UiObject
      • UiSelector
    • 交互相关

      • 全局
      • UI
      • FloatView
      • FloatController
      • LayoutParams
      • LayoutParamsFlag
    • 其他
  • UI的API

    • 全局变量
    • 视图

      • View 类
      • window 类
      • Label 类
      • ImageButton 类
      • EditTextView 类
      • ScrollView 类
      • LinearLayout 类
      • Alert 类
      • Toast 类
      • Dialog 类
      • Switch 类
      • TabSegmentView 类
      • TableView 类
      • TableViewAdapter 类
      • TableViewAutoFitAdapter 类
      • CollectionView 类
      • CollectionViewAdapter 类
      • CollectionViewAutoFitAdapter 类
      • CollectionViewLayout 类
      • WaterfallView 类
      • WaterfallAdapter 类
      • WaterfallLayout 类
      • ViewPager 类
      • ViewPagerAdapter 类
    • 动画
    • 数据

      • Map 类
      • Array 类
      • Point 类
      • Size 类
      • Rect 类
      • Color 类
      • StyleString 类
    • 工具

      • Loading 类
      • Http 类
      • System 类
      • Timer 类
      • MBit 类
      • File 类
      • Application 类
      • Navigator 类
      • PreferenceUtils 类
      • TypeUtils 类
      • StringUtil 类
      • NetworkReachability 类
      • GlobalEvent 类
      • Clipboard 类
      • CornerManager 类
    • 枚举

      • ContentMode 枚举
      • TextAlign 枚举
      • BreakMode 枚举
      • FontStyle 枚举
      • UnderlineStyle 枚举
      • RepeatType 枚举
      • InterpolatorType 枚举
      • AnimType 枚举
      • EditTextViewInputMode 枚举
      • ReturnType 枚举
      • ScrollDirection 枚举
      • StatusBarStyle 枚举
      • RectCorner 枚举
      • LinearType 枚举
      • Gravity 枚举
      • MeasurementType 枚举
      • ValueType 枚举
      • GradientType 枚举
      • TabSegmentAlignment 枚举
      • NetworkState 枚举
      • CachePolicy 枚举
      • ResponseKey 枚举
      • ErrorKey 枚举
      • EncType 枚举

ImageView 类

继承 View

图片展示类控件,目前两端支持自适应尺寸,前提是一边固定,SDK根据图片比例自行计算另一边的尺寸

用于本地或者网络图片展示,可以添加点击事件

@note 非容器视图,不可以添加子视图

变量

_priveta_class_name : string

name : string

方法

contentMode

设置图片的填充模式

@note 默认为SCALE_ASPECT_FIT,详情参见ContentMode;模式要在设置图片前设置,不建议动态修改

参数

  • contentMode : ContentMode 填充模式的枚举值

返回值

  • : ImageView

contentMode

获取图片填充模式

@note 默认为SCALE_ASPECT_FIT,详情参见ContentMode

返回值

  • 图片填充模式枚举值 : number

lazyLoad

设置在滚动控件中,滚动时是否加载图片,默认为true不加载

@note 该属性为Android端特性,iOS设置时无效果

参数

  • lazyLoad : boolean true滑动时不加载图片,false滑动时候加载

返回值

  • : ImageView

lazyLoad

获取在滚动控件中,滚动时是否加载图片,默认为true不加载

@note 该属性为Android端特性,iOS设置时无效果

返回值

  • true滑动时不加载图片,false滑动时候加载 : boolean

startAnimationImages

开始播放图片的帧动画,支持本地及网络图片

参数

  • images : table 图片的集合
  • during : number 播放时长
  • repeat : boolean 是否重复,默认不重复

返回值

  • : ImageView

stopAnimationImages

停止播放图片的帧动画

返回值

  • : ImageView

isAnimating

是否正在播放图片帧动画

返回值

  • : boolean

image

可以设置网络或本地图片

参数

  • url : string 网络URL、本地图片名称或本地path

返回值

  • : ImageView

setImageUrl

设置图片及占位图

参数

  • image : string 本地图片path或网络图片URL
  • holder : string 占位图path或者URL

返回值

  • : ImageView

setCornerImage

设置图片及占位图,并且切割圆角

该方法会在第一次加载图片时异步将图片裁剪出相应圆角,之后再次加载不在需要额外处理。

@note 用于改善图片圆角切割带来的性能问题,多图片圆角推荐使用

参数

  • image : string 本地图片path或网络图片URL
  • holder : string 占位图path或者URL
  • corner : number 圆角大小
  • direct : RectCorner 圆角位置枚举,详情见RectCorner

返回值

  • : ImageView

setImageWithCallback

设置图片、占位图及回调

 图片加载结果回调,格式为:
	```
	function(success, error, imgURL)
		--- success为boolean,加载是否成功
		--- error为string,加载失败的信息
		--- imgURL为string,请求的图片地址
	end
	```

参数

  • image : string 本地图片path或网络图片URL
  • holder : string 占位图path或者URL
  • callback : function(success|error|imgURL)

返回值

  • : ImageView

setNineImage

加载.9图

@note Android为drawable目录下相对路径,无后缀,iOS需要使用带.9名称后缀图片

参数

  • image : string 本地图片地址

返回值

  • : ImageView

blurImage

设置ImageView高斯模糊效果

@note iOS下为全ImageView模糊,提高效率,故需要ImageView设置填充模式

参数

  • number : number 高斯模糊程度 0 ~ 25,数值越大,模糊越明显
  • bool : boolean true:采用处理图片高斯模糊方式(PS:性能较差效果较好),false:图片上覆盖一个白色蒙层 (android都按高斯模糊处理)

返回值

  • : ImageView