android 自定义View属性
在android开发过程中,用到系统的View时候可以通过XML来定义一些View的属性。比如ImageView:


.png)


.png)

.png)
xml version="1.0" encoding ="utf-8" ?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width= "fill_parent"
android:layout_height= "match_parent"
android:layout_gravity= "center"
android:background= "#123456" > <LinearLayout
android:id="@+id/left_ll"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:gravity="center_vertical|left"
android:orientation="horizontal" > <ImageView
android:id="@+id/left_iv"
android:layout_width="25dip"
android:layout_height="match_parent"
android:src="@drawable/back"
android:layout_marginLeft="10dip" /> < TextView
android:id="@+id/left_tv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dip"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:text="返回"
android:textSize="16sp" />
</LinearLayout> <LinearLayout
android:id="@+id/right_ll"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:orientation="horizontal" > <ImageView
android:id="@+id/right_iv"
android:layout_width="25dip"
android:layout_height="match_parent"
android:src="@drawable/next"
android:layout_marginLeft="10dip" /> < TextView
android:id="@+id/right_tv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dip"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:text="下一步"
android:textSize="16sp" />
</LinearLayout> <LinearLayout
android:id="@+id/middle_ll"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/right_ll"
android:layout_toRightOf="@id/left_ll"
android:gravity="center_horizontal"
android:orientation="horizontal" > < TextView
android:id="@+id/middle_tv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="我是标题"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:textSize="16sp" /> <ImageView
android:id="@+id/middle_iv"
android:layout_width="25dip"
android:layout_height="match_parent"
android:src="@drawable/click_down"
/>
</LinearLayout> </RelativeLayout>

.png)
<?xml version="1.0" encoding ="utf-8" ?>
<resources> <declare-styleable name= "CommonTitleView">
< attr name= "leftTv" format ="integer" />
< attr name= "leftIv" format ="integer" />
< attr name= "rightTv" format ="integer" />
< attr name= "rightIv" format ="integer" />
< attr name= "middleTv" format ="integer" />
< attr name= "middleIv" format ="integer" />
</declare-styleable> </resources>

.png)

.png)





android 自定义View属性的更多相关文章
- android自定义view属性
第一种 /MainActivity/res/values/attrs.xml <?xml version="1.0" encoding="utf-8"?& ...
- Android读取自定义View属性
Android读取自定义View属性 attrs.xml : <?xml version="1.0" encoding="utf-8"?> < ...
- (转)[原] Android 自定义View 密码框 例子
遵从准则 暴露您view中所有影响可见外观的属性或者行为. 通过XML添加和设置样式 通过元素的属性来控制其外观和行为,支持和重要事件交流的事件监听器 详细步骤见:Android 自定义View步骤 ...
- Android 自定义View (五)——实践
前言: 前面已经介绍了<Android 自定义 view(四)-- onMeasure 方法理解>,那么这次我们就来小实践下吧 任务: 公司现有两个任务需要我完成 (1)监测液化天然气液压 ...
- Android 自定义 view(三)—— onDraw 方法理解
前言: 上一篇已经介绍了用自己定义的属性怎么简单定义一个view<Android 自定义view(二) -- attr 使用>,那么接下来我们继续深究自定义view,下一步将要去简单理解自 ...
- Android 自定义view(二) —— attr 使用
前言: attr 在前一篇文章<Android 自定义view -- attr理解>已经简单的进行了介绍和创建,那么这篇文章就来一步步说说attr的简单使用吧 自定义view简单实现步骤 ...
- [原] Android 自定义View步骤
例子如下:Android 自定义View 密码框 例子 1 良好的自定义View 易用,标准,开放. 一个设计良好的自定义view和其他设计良好的类很像.封装了某个具有易用性接口的功能组合,这些功能能 ...
- [原] Android 自定义View 密码框 例子
遵从准则 暴露您view中所有影响可见外观的属性或者行为. 通过XML添加和设置样式 通过元素的属性来控制其外观和行为,支持和重要事件交流的事件监听器 详细步骤见:Android 自定义View步骤 ...
- Android -- 自定义View小Demo,动态画圆(一)
1,转载:(http://blog.csdn.NET/lmj623565791/article/details/24500107),现在如下图的效果: 由上面的效果图可以看到其实是一个在一个圆上换不同 ...
随机推荐
- 【转】Apache httpd.conf配置解释
转自:http://jafy00.blog.51cto.com/2594646/501373 常用配置指令说明 1. ServerRoot:服务器的基础目录,一般来说它将包含conf/和logs/子目 ...
- 【前端】JS截取字符串常用方法详细整理
函数:split() 功能:使用一个指定的分隔符把一个字符串分割存储到数组 例子: str=”jpg|bmp|gif|ico|png”; arr=theString.split(”|”); //arr ...
- elsarticle模板 去掉摘要前后的两条横线
参考:http://www.newsmth.net/nForum/#!article/TeX/316697?au=ericfire 如图:使用elsarticle模板修改PDF格式,去掉摘要前后的横线 ...
- [BZOJ4870][Shoi2017]组合数问题 dp+矩阵乘
4870: [Shoi2017]组合数问题 Time Limit: 10 Sec Memory Limit: 512 MB Description Input 第一行有四个整数 n, p, k, r ...
- "XX cannot be resolved to a type "eclipse报错及解决
好久都没有写博了,还记得自己准备考研,结果你会发现——你永远不知道,你将会走上哪个路. 长远的目标是好的,但有些时候身不由己也迫不得已!做好自己的当下就是好的. 不论搞什么,总会遇到各种各样的问题,以 ...
- 70路小报:用PV和UV作为网站衡量指标已经过时
方法]投资人呼吁:PV和UV不应该再作为产品衡量指标 风险投资机构Andreessen Horowitz近日一直反对再用传统的网站衡量指标去评价互联网产品,比如PV和UV,甚至包括应用的下载量. 他们 ...
- 最近公共祖先(LCA)(题目)
Time Limit: 2000 ms Memory Limit: 256 MB Description Input Output Sample Input 15 5 1 2 3 4 5 6 7 8 ...
- python学习(九) 网络编程学习--简易网站服务器
python `网络编程`和其他语言都是一样的,服务器这块步骤为:`1. 创建套接字``2. 绑定地址``3. 监听该描述符的所有请求``4. 有新的请求到了调用accept处理请求` Python ...
- Java 开发岗面试知识点
本文作者在一年之内参加过多场面试,应聘岗位均为 Java 开发方向.在不断的面试中,分类总结了 Java 开发岗位面试中的一些知识点. 主要包括以下几个部分: Java 基础知识点 Java 常见集合 ...
- C语言 两个小知识点
strlen 函数原型 extern unsigned int strlen(char *s); 在Visual C++ 6.0中,原型为size_t strlen(const char *strin ...