歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Android UI布局 layer-list

Android UI布局 layer-list

日期:2017/3/1 10:27:03   编辑:Linux編程

當我們想把多個圖層疊在一起顯示的時候,可以使用layer-list

在/res/drawable/文件夾下建立 test.xml

內容如下:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <layer-list xmlns:Android="http://schemas.android.com/apk/res/android">
  3. <item>
  4. <shape>
  5. <solid android:color="#FFB2B9BE"/>
  6. </shape>
  7. </item>
  8. <item android:bottom="1px">
  9. <shape>
  10. <gradient android:startColor="#FFDCE2E6" android:endColor="#FFBAC2C6" android:angle="-90"/>
  11. </shape>
  12. </item>
  13. </layer-list>

使用的時候和其他的資源文件的使用方法一樣 android:background="@drawable/test"

Copyright © Linux教程網 All Rights Reserved