Nok*_*uap 38 android android-framelayout
我有这样的FrameLayout:
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="changeColor"
        android:text="new button"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="some text"/>
</FrameLayout>
问题是按钮显示在顶部,而FrameLayout类概述告诉我们:"子视图是在堆栈中绘制的,最近添加的子项位于顶部".
Kho*_* Vo 15
在Android 5.0(API 21)及更高版本中,您必须在视图中添加android:elevation.
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="changeColor"
        android:text="new button"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="some text"
        android:elevation="3dp"/>
| 归档时间: | 
 | 
| 查看次数: | 15504 次 | 
| 最近记录: |