在Drawable文件夹下建立xml文件:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <shape xmlns:andro
  3.     android:shape="rectangle">
  4.   <gradient
  5.       android:startColor="#00000000"
  6.       android:centerColor="#FFFFFFFF"
  7.       android:endColor="#00000000"
  8.       android:angle="0" />
  9. </shape>

    shape 节点配置的是图形的形式,主要包括方形、圆形等,上边代码为方形,

    gradient 节点主要配置起点颜色、终点颜色及中间点的颜色、坐标、渐变效果(angle)(0,90,180左到右渐变,270上到下渐变)默认从左到右
    padding 节点主要配置上下左右的间距

    corners 节点配置四周园脚的半径 

最后需要使用处的xml文件中调用即可:android:backgroud="drawable/你的文件的名字"

相关文章:

  • 2022-12-23
  • 2021-09-11
  • 2021-10-07
  • 2021-06-22
  • 2021-08-31
  • 2022-01-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-14
  • 2021-09-26
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
相关资源
相似解决方案