效果如图
用xml创建带圆角和阴影的按钮背景

按钮布局文件

<Button

    android:layout_width="match_parent"

    android:layout_height="80dip"

    android:background="@drawable/hi"

    android:text="@string/click_button"

    android:textColor="#999"

    android:textSize="18dip"

    android:textStyle="bold" />

背景drawable文件

<?xml version="1.0" encoding="utf-8"?>

    <layer-list xmlns:andro >

    <!-- Bottom 2dp Shadow -->

    <item android:bottom="11px" android:top="19px" android:left="10px" android:right="10px">

        <shape android:shape="rectangle" >

            <solid android:color="#ccc" />

            <corners android:radius="7dp" />

        </shape>

    </item>

    <!-- White Top color -->

    <item android:bottom="15px" android:top="15px" android:left="10px" android:right="10px">

        <shape android:shape="rectangle" >

            <solid android:color="#FFFFFF" />

            <corners android:radius="7dp" />

        </shape>

    </item>

</layer-list>

相关文章:

  • 2021-04-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-17
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案