I have to find out all the views higher in z-index ( could be overlapping ) than given view
public List<View> getViewsHigherInZIndex(View givenView)
{
//return all views higher in z index than givenView
}
One of the approach I thought involves finding Parent View of given View and then recursively finding all the elements. Even though I have all the View elements, how can I determine z-index of the child views. How can I compare them to find out if they are overlapping. I can get Rectangle bounds and see if they are intersecting but that doesn't give z-order.
1 个答案:
答案 0 :(得分:0)
You could use a recursive DFS to walk the View hierarchy with ViewGroup.getChildAt(), then use View.getZ() to compare Z values.