android - 高程在 ContraintLayout 中不起作用
问题描述
我不知道为什么android:elevation
不工作
我的代码:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".UI.Activity.ChatActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:elevation="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.07"
app:layout_constraintStart_toStartOf="parent"
android:gravity="center_vertical">
<EditText
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="8"
android:inputType="text"
android:layout_marginLeft="15dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:background="@drawable/border_edit_text_messenger"
android:textCursorDrawable="@color/colorWhite"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.8"
android:src="@drawable/ic_send"
android:scaleType="centerInside"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
解决方案
在您将任何背景颜色设置为要设置高程的ViewGroup
或之前,高程无法以某种方式起作用。View
放
android:background="@color/colorWhite"
android:elevation="2dp"
到上述 xml 中的 LinearLayout。
推荐阅读
- reactjs - Reactjs - jquery 未在 npm 安装库中定义 - jquery.reel
- excel - 将用户窗体文本框中的文本粘贴到另一个工作表上的 ActiveCell 的相应单元格
- python - 在 Python 中使用 tkinter 打包帧的问题
- arrays - 如何用数组中的元素替换文件中的单词
- kubernetes - 转义 helm yml 进行部署
- django - 如何根据外键的主键上传文件?
- android - 如何在 AR 中将 3D 模型放置在屏幕中心,并相对于轴上的摄像机角度将其移动近或远?
- c# - LINQ如何在where子句中将方法变量作为列名传递
- java - 在初始化期间在 H2 数据库中设置别名
- ruby - ruby 代码中的这种代码注释样式是什么