Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6549499
  • 博文数量: 915
  • 博客积分: 17977
  • 博客等级: 上将
  • 技术积分: 8846
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-26 09:59
个人简介

一个好老好老的老程序员了。

文章分类

全部博文(915)

文章存档

2022年(9)

2021年(13)

2020年(10)

2019年(40)

2018年(88)

2017年(130)

2015年(5)

2014年(12)

2013年(41)

2012年(36)

2011年(272)

2010年(1)

2009年(53)

2008年(65)

2007年(47)

2006年(81)

2005年(12)

分类: Android平台

2015-03-20 22:01:04

本例的主要布局文件是完成在一个ImageView的图片右上角添加红色背景白色字体的圆形角标。
主布局文件如下:

点击(此处)折叠或打开

  1. <RelativeLayout xmlns:android=""
  2.     xmlns:tools=""
  3.     android:layout_width="match_parent"
  4.     android:layout_height="match_parent"
  5.     tools:context="${relativePackage}.${activityClass}" >

  6.     <ImageView
  7.         android:contentDescription="wait scan image"
  8.         android:id="@+id/ivButton"
  9.         android:layout_width="wrap_content"
  10.         android:layout_height="wrap_content"
  11.         android:src="@drawable/waitscan" />

  12.     <TextView
  13.         android:layout_width="30dp"
  14.         android:layout_height="30dp"
  15.         android:gravity="center"
  16.         android:layout_alignParentTop="true"
  17.         android:layout_alignRight="@+id/ivButton"
  18.         android:background="@drawable/circletext_bg"
  19.         android:text="5"
  20.         android:textSize="20sp"
  21.         android:textColor="@android:color/white" />
  22.  
  23. </RelativeLayout>
红色背景圆形文本框的资源文件circletext_bg.xml的内容如下:

点击(此处)折叠或打开

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <layer-list xmlns:android="">
  3. <item>
  4. <shape>
  5. <stroke android:width="1px" android:color="@android:color/holo_red_dark" /><!--边框颜色-->
  6. <solid android:color="@android:color/holo_red_dark" /><!--填充色-->
  7. <corners android:radius="15dp" />
  8. </shape>
  9. </item>
  10. </layer-list>


阅读(8138) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~