V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
liuyanjun0826
V2EX  ›  Android

这段代码是什么意思?不断等待打开图片?

  •  
  •   liuyanjun0826 · 2018-12-07 08:00:40 +08:00 · 3908 次点击
    这是一个创建于 1938 天前的主题,其中的信息可能已经有所发展或是发生改变。
    runBlocking {
    delay(50)

    val recyclerView = activityRule.activity.findViewById<RecyclerView>(android.R.id.list)!!
    val viewHolder = recyclerView.findViewHolderForAdapterPosition(0)!!
    val imageView = viewHolder.itemView.findViewById<ImageView>(R.id.story_image)!!

    withTimeout(10000) {
    while (true) {
    if (imageView.visibility == View.VISIBLE && imageView.drawable != null) {
    break // good
    }
    delay(50)
    }
    }
    }
    liuyanjun0826
        1
    liuyanjun0826  
    OP
       2018-12-07 08:12:54 +08:00
    是不是本地图片和网络图片同时显示时打断
    rumengzhenxing
        2
    rumengzhenxing  
       2018-12-07 09:42:25 +08:00
    imageview 显示 或者 imageview 里的 drawable 不为 null,跳出。
    liuyanjun0826
        3
    liuyanjun0826  
    OP
       2018-12-07 09:57:59 +08:00 via Android
    @rumengzhenxing 那是 And 不是 or 啊,是不是看错了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1134 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 18:43 · PVG 02:43 · LAX 11:43 · JFK 14:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.