【发布时间】:2016-06-08 16:13:51
【问题描述】:
看代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<Button
android:id="@+id/wi_fi_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#feeca0"
android:text="some text"
android:textColor="#b5a24f" />
<ProgressBar
android:id="@+id/wifi_progressBar"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true" />
</RelativeLayout>
这种类型的元素放置,在将 UI 主题更新为 AppCompat 之前工作。更新后,所有按钮在所有情况下都重叠元素,即使它们必须是upper(根据xml代码)
这是我的 ActivityThem 风格
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:textAppearanceButton">@style/AppTheme.ButtonsTextAppearance</item>
<item name="switchStyle">@style/SwitcherStyle</item>
</style>
如您所见,只有 textAppearance 覆盖。 Button(Base.Widget.AppCompat.Button) 的父组件没有任何特殊属性(我希望在 web ccs - z-index 中找到类似的东西)。 我解决了这个问题:只需用框架布局包装按钮,我的行为就会返回(进度条在按钮视图上绘制)。
那么,有没有人知道这是 AppCompat 中 Button 的错误或功能?
P.S:来自 AS 的屏幕截图,但在设备上的行为也相同。
【问题讨论】:
标签: android android-appcompat android-theme android-styles