user3240604
user3240604

Reputation: 417

Android bringToFront() View API <= 16

When I was testing my app, I realized that if I use a device with API <= 16 the method bringToFront() does not work! How can I do this for APIs less than 16? When I touch a view, I need to bring it to the front! With API 17 or greater, bringToFront() works.

Thanks

Upvotes: 2

Views: 527

Answers (2)

SuperFrog
SuperFrog

Reputation: 7674

From the documentation:

public void bringToFront () Added in API level 1

Change the view's z order in the tree, so it's on top of other sibling views. This ordering change may affect layout, if the parent container uses an order-dependent layout scheme (e.g., LinearLayout). Prior to KITKAT this method should be followed by calls to requestLayout() and invalidate() on the view's parent to force the parent to redraw with the new child ordering.

Upvotes: 2

LBes
LBes

Reputation: 3456

Just by using the documentation you can read there (http://developer.android.com/reference/android/view/View.html) that:

Change the view's z order in the tree, so it's on top of other sibling views. This ordering change may affect layout, if the parent container uses an order-dependent layout scheme (e.g., LinearLayout). Prior to KITKAT this method should be followed by calls to requestLayout() and invalidate() on the view's parent to force the parent to redraw with the new child ordering.

So it does work on early APIs, it's just that you should use it a little bit differently ;)

Upvotes: 1

Related Questions