How can you tell if a View is visible on screen in Android?

后端 未结 5 843
你的背包
你的背包 2020-12-23 19:32

I want to check if a View within a ScrollView is currently visible in Android. I am not checking if it is focused on yet but if it is currently bei

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-23 20:03

    try

    if(view.isShown()) {
        // Visible
    } else { 
        // Invisible
    }
    

提交回复
热议问题