Android 5.0, android5.0
In versions earlier than SDK <21, the ProgressBar can be displayed in front of the button, and is in the middle of the button. However, after switching to android 5.0, the progress bar shows a change in order, and the button is displayed in front, progressBar is behind
My xml configuration file is as follows:
<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/button_action" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Login" /> <ProgressBar android:id="@+id/progress_bar" android:layout_width="50dp" android:layout_height="50dp" android:layout_centerInParent="true"/> </RelativeLayout>
During debugging, you can use the "Show layout bounds display bounds" option in the development option settings to correctly locate the component, but you cannot see anything on the screen during the display.
I am using the Theme. AppCompat style recently released from support. v7.
EDIT:
I also applied the code to set setElevation (0) and setTranslationY (0) for the button, which did not play any role.
Solution
I have been trying to set the translationZ to 0, but I have never thought about setting the translationZ> 0 of ProgressBar,
You only need to set the translationZ attribute of ProgressBar.
Address: http://www.itmmd.com/201412/290.html
This article is organized and published by Meng IT personnel. The reprinted article must indicate the source.