我认为标题非常明确我的问题......所以这是我的布局:
<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>
Run Code Online (Sandbox Code Playgroud)
在android SDKs <21上没问题,ProgressBar正确地显示在Button上并且在Button中居中.但是在Android 5.0上,ProgressBar显示在 Button 后面.
因此,当您在"开发者选项"设置中激活"显示布局边界"选项时,您可以看到它已正确定位,但如果没有该选项,您将无法在屏幕上看到任何内容.
有人知道如何解决这个问题吗?我想这是一个事海拔最近推出的,但我真的不知道该怎么照顾它.为了记录,我正在使用support.v7中最近发布的Theme.AppCompat样式.
编辑:
我还尝试以编程方式应用setElevation(0)和setTranslationY(0)按钮,但它没有改变任何东西.所以我想知道它是否必须处理高程.
先谢谢你们
马蒂厄
android android-progressbar android-button android-5.0-lollipop