How To Bring A View To Front Without Calling Bringtofront()?
Solution 1:
apparently I missed the android:clipChildren="false"
property in GridView. It solves my problem.
Solution 2:
Have you tried making the View
focusable and just calling requestFocus()?
Solution 3:
Calling bringToFront() changes the ordering in the GridView. Try creating an ImageView with an image of the view you want to animate and animate that instead.
Bitmapbitmap= Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Canvascanvas=newCanvas(bitmap);
view.draw(canvas);
finalImageViewimageView=newImageView(getActivity());
imageView.setImageBitmap(bitmap);
ViewGroup.LayoutParamsparams=newViewGroup.LayoutParams(view.getWidth() , view.getHeight());
imageView.setLayoutParams(params);
rootview.addView(imageView);
Add an animation listener to your animation and remove the ImageView at the end of the animation.
Solution 4:
From API 21 you can call:
view.setZ(float)
Solution 5:
If you target API above 21, you can simply add the attribute android:translationZ="xxx dp"
to your XML.
Please note that if you add elevation in views like cardview, you go into the Z axis. And if you want a view come to foreground using this way, you just have to make it higher than the elevation you set.
Example : 6 dp elevation in cardview will require a 7dp in the attribute translationZ of the view you want foreground.
Post a Comment for "How To Bring A View To Front Without Calling Bringtofront()?"