MD风格下拉刷新
2023-01-24 09:16:15 最后更新
cls("android.support.v4.widget.SwipeRefreshLayout",swl)
cls("android.graphics.Color",cr)
javanew(ss.srlt, swl, "Context", activity)
nvw(ss.srlt,1)
//设置颜色
call(color_list,"mlua","array.getColor","#009688")
sgsz(color_list,0,c)
syso(color_list)
javax(null,ss.srlt,swl,"setColorSchemeColors","int[]",color_list)
//设置事件
java(listener,ss.srlt,"android.support.v4.widget.SwipeRefreshLayout.setOnRefreshListener",".android.support.v4.widget.SwipeRefreshLayout$OnRefreshListener",null)
{
  f(st_mD ? "onRefresh")
  {
    tw("刷新吗?")
    javax(null,ss.srlt,swl,"setRefreshing","boolean",false)
    //下拉刷新事件
  }
}
nvw(10086, ss.srlt, "列表", "width=-2\nheight=-2", listview)
//添加数据
ula(data,1=1)
ula(data,1=2)
ula(data,1=3)
ula(data,1=4)
ula(data,1=5)
ula(data,1=6)
ula(data,1=1)
ula(data,1=2)
ula(data,1=3)
ula(data,1=4)
ula(data,1=5)
ula(data,1=6)
uls(listview,data,"item.iyu",-1,"100dp")
--以下代码放在array.mlua界面--〔
function getColor(color)
  import "android.graphics.*"
  color = Color:parseColor(tos(color))
  List = i:nsz(1,"int")
  i:sssz(List,0,toi(color))
  return List
end
--End〕
//点击刷新(放iyu界面)
java(null,ss.srlt,"android.support.v4.widget.SwipeRefreshLayout.setRefreshing","boolean",true)
tw("刷新")
t()
{
  stop(2500)
  ufnsui()
  {
    java(null,ss.srlt,"android.support.v4.widget.SwipeRefreshLayout.setRefreshing","boolean",false)
    }
}