【发布时间】:2017-12-12 13:10:58
【问题描述】:
我只是尝试为我的LinearLayout 添加阴影,以使我的视图在其他视图上表现得像这张图片facebook messenger
我尝试将此 xml 作为我的视图的背景,但它看起来像一条线而不是阴影
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="@color/black_alpha_12"
android:endColor="@android:color/transparent" android:angle="90.0" />
</shape>
我在 stackoverflow 中尝试了许多 xml 代码,没有人帮我制作我想要的阴影
【问题讨论】:
-
getSupportActionBar().setElevation(10); -
它不是
ActionBar的视图 -
选中的被称为
ActionBar -
但在我的应用程序中,我将
LinearLayout设为ActionBar,这会起作用View.setElevation(10);吗? -
@Nilu 必须等待 4 分钟才能接受 :)