Android之圆角矩形
来源:互联网 发布:北京宝库在线网络 编辑:程序博客网 时间:2024/06/06 07:08
安卓圆角矩形的定义
在drawable文件夹下,定义corner.xml
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"><!-- 填充颜色 --><solid android:color="#FF8C69"></solid><!-- 线的宽度,颜色灰色 --><stroke android:width="1dp" android:color="#D5D5D5"></stroke> <!-- 矩形的圆角半径 --><corners android:radius="10dp" /> </shape>
具体使用
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="${relativePackage}.${activityClass}" > <ImageView android:adjustViewBounds="true" android:layout_width="match_parent" android:layout_height="200dp" android:background="@drawable/b" android:padding="0dp" /><LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:layout_weight="1" > <LinearLayout android:id="@+id/l1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="3dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:background="@drawable/corner" android:gravity="center" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="二手市场" /> </LinearLayout> <LinearLayout android:id="@+id/l2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="3dp" android:layout_weight="1" android:background="@drawable/corner2" android:gravity="center" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:text="失物招领" /> </LinearLayout></LinearLayout><LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:layout_weight="1" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="vertical" > <LinearLayout android:id="@+id/l3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="3dp" android:layout_weight="1" android:background="@drawable/corner3" android:gravity="center" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:text="寻物启事" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="3dp" android:layout_weight="1" android:background="@drawable/corner4" android:gravity="center" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:text="表白墙" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="horizontal" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="3dp" android:layout_weight="1" android:background="@drawable/corner5" android:gravity="center" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:text="生活查询" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="3dp" android:layout_weight="1" android:background="@drawable/corner6" android:gravity="center" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:text="校园查询" /> </LinearLayout> </LinearLayout></LinearLayout></LinearLayout>
参考链接
android 怎么画一个圆角矩形_百度知道
效果如下
0 0
- Android之圆角矩形
- Android酱油笔记之圆角矩形
- Android自定义按钮之圆角矩形
- Android 圆角矩形
- Android之UI圆角矩形,图形圆角美化
- Android开发之自定义圆角矩形进度对话框
- Android开发之自定义圆角矩形图片ImageView
- android圆角矩形背景
- android圆角矩形进度条
- Android 圆角矩形ImageView
- Android自定义圆角矩形
- android绘制圆角矩形
- Android自定义圆角矩形
- Android button 圆角矩形
- android view绘制圆角矩形(转)
- Android 带边框的圆角矩形
- android圆角矩形有背景颜色
- android圆角矩形的实现
- 常用命令
- 【java】KDTree,实现个java版本,留着日后可能用得上
- 自学Java步骤
- Java并发编程:线程池的使用
- wifidog源码分析 - 初始化阶段
- Android之圆角矩形
- HDU 4300 (KMP)
- PHP实现文件上传与下载
- 第10、11周项目2:存储班长信息的学生类(2)
- 数据结构实验之链表六:有序链表的建立
- java RTTI和反射
- Spatial pyramid pooling (SPP)-net (空间金字塔池化)笔记
- wifidog源码分析 - wifidog原理
- SildingMenu在androidstudio上面的安装