【发布时间】:2017-09-30 11:33:50
【问题描述】:
在下面的代码中,我有一个高度为 8dp 的白色视图。蓝色按钮的高度为 10dp,因此理论上它应该显示。然而,事实并非如此。它只显示不直接位于白色视图上方的部分。我知道这与海拔有关,但我不知道到底是什么。我发现当白色视图=
这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/login_background"
android:background="@color/colorPrimary" />
<View
android:id="@+id/view"
android:layout_width="@dimen/login_container_width"
android:layout_height="@dimen/login_container_height"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/login_container_margin_top"
android:background="@drawable/login_container"
android:elevation="8dp">
</View>
<Button
android:id="@+id/button"
android:layout_width="190dp"
android:layout_height="50dp"
android:layout_marginBottom="52dp"
android:background="@drawable/login_button"
android:elevation="10dp"
android:text="LOGIN"
android:textColor="@color/white"
android:textSize="20sp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</LinearLayout>
【问题讨论】:
-
查看this question 和接受的答案,看看它是否回答了您的问题。
-
我尝试了接受的答案所说的,但是没有用。没有任何改变。
标签: android android-layout button android-elevation