Android 自定义渐变背景
16lz
2021-01-23
在Eclipse的Android工程的res下建立drawable文件夹,在drawable下新建gradient_bg.xml文件如下:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor = "#666666" android:centerColor="#000FFF" android:endColor = "#666666" android:angle = "270"/> <corners android:radius="4dip"/> </shape>
在main.xml中需要作为渐变背景的地方引用如下:
<LinearLayout android:background="@drawable/gradient_bg"></LinearLayout>
更多相关文章
- Android下 布局加边框 指定背景色 半透明
- ListView背景修饰
- Android中背景选择器
- zz浅谈android的selector,背景选择器
- 【Android】编写Drawable XML绘制底部带指示条的背景
- android shape 代码实现按钮背景