Android之UI圆角矩形,图形圆角美化
来源:互联网 发布:知已的近义词 编辑:程序博客网 时间:2024/05/17 03:11
创建工程Android_StyleAndUIShape下的res文件夹下->new other->Android XML File->Next->Resource Type下选择Drawable->选择shape->File命名为button_shape
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="45" android:endColor="#80FF00FF" android:gradientRadius="100.0" android:startColor="#FFFF0000" android:type="radial" > </gradient> <padding android:bottom="7dp" android:left="7dp" android:right="7dp" android:top="7dp" /> <corners android:topLeftRadius="12dp" android:topRightRadius="12dp" > </corners></shape>
<Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="192dp" android:background="@drawable/button_shape" android:textSize="90sp" android:text="Button" />效果图如下
在drawable中新建两个文件view_shape.xml
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:endColor="#CCCCCC" android:startColor="#CCCCCC" > </gradient> <corners android:topLeftRadius="12dp" android:topRightRadius="12dp" > </corners> <size android:height="100dp" android:width="200dp" /> <stroke android:dashWidth="3dp" android:width="3dp" android:color="#FFDDCC" > </stroke> <!-- 填充图形的颜色 <solid android:color="#000000"/> --></shape>和view_bottom.xml
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:endColor="#CCFFDD" android:startColor="#CCFFDD" /> <corners android:bottomLeftRadius="12dp" android:bottomRightRadius="12dp" > </corners> <size android:height="100dp" android:width="200dp" /> <!-- 填充图形的颜色 <solid android:color="#000000"/> --></shape>
在activity_main.xml中
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/button1" android:layout_marginTop="36dp" android:background="@drawable/view_shape" android:orientation="vertical" > </LinearLayout> <LinearLayout android:id="@+id/linearLayout2" android:layout_width="200dp" android:layout_height="100dp" android:layout_alignLeft="@+id/linearLayout1" android:layout_alignRight="@+id/linearLayout1" android:layout_centerVertical="true" android:background="#CCCCCC" android:orientation="vertical" > </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/linearLayout2" android:layout_alignRight="@+id/linearLayout2" android:layout_below="@+id/linearLayout2" android:background="@drawable/view_bottom" android:orientation="vertical" > </LinearLayout>
效果图
0 0
- Android之UI圆角矩形,图形圆角美化
- 【安卓知识汇总】android 美化圆角图形
- Android之圆角矩形
- android之UI美化
- WINCE图形编程之绘制圆角矩形
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形) --图像图形
- Android酱油笔记之圆角矩形
- Android自定义按钮之圆角矩形
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形)
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形) .
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形)
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形)
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形)
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形)
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形)
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形)
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形)
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形)
- Derby的安装与使用
- 向量三角形
- Spring整合log4j日志组件
- 序列化与反序列化
- centos yum 只下载包 不安装
- Android之UI圆角矩形,图形圆角美化
- PHP学习练手(五)
- 2730: [HNOI2012]矿场搭建
- Opencv--常用操作函数讲解
- 菜鸟的3天leetecode 之旅
- Xen 和 KVM 下如何关闭 virbr0
- phpcmsV9 二级栏目的获取
- Android实现不重复启动APP的方法
- EasyUI Datebox 日期框