0

I have the following code that works:

Button b = (Button) findViewById(R.id.my_button);
if(b != null) {
    Rect bounds = new Rect();
    parentLayout.getHitRect(bounds);
    if(b.getLocalVisibleRect(bounds)) {
        //it is visible, do code
    }
}

Question: How can I change the code so that the I do what I am currently doing inside if(b.getLocalVisibleRect(bounds)) but when the middle of or the complete button has appeared?
With my code now, I can detect when the upper edge of the button has appeared. But it would be best if I was able to detect when almost all of the button has appeared.

Jim
  • 18,826
  • 34
  • 135
  • 254

0 Answers0