猿问

Android LinearLayout:在LinearLayout周围添加阴影边框

Android LinearLayout:在LinearLayout周围添加阴影边框

我想创建此LinearLayout的相同边框作为示例:

在这个例子中,我们可以看到linearLayout周围的边界不一样。如何使用XML可绘制文件创建它?

现在,我只能在LinearLayout周围创建一个简单的边框,如下所示:

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
  <corners
      android:radius="1dp"
      android:topRightRadius="0dp"
      android:bottomRightRadius="0dp"
      android:bottomLeftRadius="0dp" />
  <stroke
      android:width="1dp"
      android:color="#E3E3E1" />

  <solid android:color="@color/blanc" /></shape>

大话西游666
浏览 7453回答 3
3回答

撒科打诨

如果您已经从形状中获得边框,则只需添加高程:<LinearLayout &nbsp;&nbsp;&nbsp;&nbsp;android:id="@+id/layout" &nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;android:elevation="2dp" &nbsp;&nbsp;&nbsp;&nbsp;android:background="@drawable/rectangle"&nbsp;/>
随时随地看视频慕课网APP

相关分类

Android
我要回答