Android 相对年轻的佐德棒棒糖
我在API 19:4.2.2上有一个小布局可以正常工作,但在API 21:5.0.1上无法正常工作 布局如下:Android 相对年轻的佐德棒棒糖,android,android-layout,android-5.0-lollipop,Android,Android Layout,Android 5.0 Lollipop,我在API 19:4.2.2上有一个小布局可以正常工作,但在API 21:5.0.1上无法正常工作 布局如下: <?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="
<?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="match_parent" >
<Button
android:id="@+id/start_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textStyle="bold"
android:textSize="30sp"
android:background="@color/start_button_bg"
android:textColor="@color/start_button_text"
android:text="@string/start_process"/>
<TextView
android:id="@+id/pro_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:textColor="@android:color/white"
android:background="@drawable/pro_icon"
android:text="PRO"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</RelativeLayout>
非常简单的东西。我只希望文本视图位于相对布局中的按钮上方。我知道相对布局堆栈视图在xml中的添加顺序,但在棒棒糖上似乎不一样。我无法通过按钮渲染TextView。有什么想法吗
干杯。默认情况下,安卓5.0+上的
按钮具有提升功能;TextView
没有。小部件的提升基本上会覆盖由RelativeLayout
或FrameLayout
设置的Z轴顺序
你的选择是:
重新设计UI,使其不在Z轴上订购小部件,或
,或
尝试通过android:elevation
将TextView
的高程更改为高于按钮的高程
没有注意到立面属性。谢谢另一方面,在改变视图高度时,有没有办法去除阴影?@Notbad:可能,但我不知道技术。