liuyanjun0826
V2EX  ›  Android

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

  •  
  •   liuyanjun0826 · Dec 7, 2018 · 12461 views
    This topic created in 2720 days ago, the information mentioned may be changed or developed.
    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
       Dec 7, 2018
    是不是本地图片和网络图片同时显示时打断
    rumengzhenxing
        2
    rumengzhenxing  
       Dec 7, 2018
    imageview 显示 或者 imageview 里的 drawable 不为 null,跳出。
    liuyanjun0826
        3
    liuyanjun0826  
    OP
       Dec 7, 2018 via Android
    @rumengzhenxing 那是 And 不是 or 啊,是不是看错了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3132 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 12:39 · PVG 20:39 · LAX 05:39 · JFK 08:39
    ♥ Do have faith in what you're doing.