1. reference:参考某一资源ID。(1)属性定义:<declare-styleable name = "名称"><attr name = "background" format = "reference" /></declare-styleable>(2)属性使用:<ImageViewandroid:layout_width = "42dip"android:layout_height = "42dip"android:background = "@drawable/图片ID"/>2. color:颜色值。(1)属性定义:<declare-styleable name = "名称"><attr name = "textColor" format = "color" /></declare-styleable>(2)属性使用:<TextViewandroid:layout_width = "42dip"android:layout_height = "42dip"android:textColor = "#00FF00"/>3. boolean:布尔值。(1)属性定义:<declare-styleable name = "名称"><attr name = "focusable" format = "boolean" /></declare-styleable>(2)属性使用:<Buttonandroid:layout_width = "42dip"android:layout_height = "42dip"android:focusable = "true"/>4. dimension:尺寸值。(1)属性定义:<declare-styleable name = "名称"><attr name = "layout_width" format = "dimension" /></declare-styleable>(2)属性使用:<Buttonandroid:layout_width = "42dip"android:layout_height = "42dip"/>5. float:浮点值。(1)属性定义:<declare-styleable name = "AlphaAnimation"><attr name = "fromAlpha" format = "float" /><attr name = "toAlpha" format = "float" /></declare-styleable>(2)属性使用:<alphaandroid:fromAlpha = "1.0"android:toAlpha = "0.7"/>6. integer:整型值。(1)属性定义:<declare-styleable name = "AnimatedRotateDrawable"><attr name = "visible" /><attr name = "frameDuration" format="integer" /><attr name = "framesCount" format="integer" /><attr name = "pivotX" /><attr name = "pivotY" /><attr name = "drawable" /></declare-styleable>(2)属性使用:<animated-rotatexmlns:android = "http://schemas.android.com/apk/res/android"  android:drawable = "@drawable/图片ID"  android:pivotX = "50%"  android:pivotY = "50%"  android:framesCount = "12"  android:frameDuration = "100"/>7. string:字符串。(1)属性定义:<declare-styleable name = "MapView"><attr name = "apiKey" format = "string" /></declare-styleable>(2)属性使用:<com.google.android.maps.MapViewandroid:layout_width = "fill_parent"android:layout_height = "fill_parent"android:apiKey = "0jOkQ80oD1JL9C6HAja99uGXCRiS2CGjKO_bc_g"/>8. fraction:百分数。(1)属性定义:<declare-styleable name="RotateDrawable"><attr name = "visible" /><attr name = "fromDegrees" format = "float" /><attr name = "toDegrees" format = "float" /><attr name = "pivotX" format = "fraction" /><attr name = "pivotY" format = "fraction" /><attr name = "drawable" /></declare-styleable>(2)属性使用:<rotatexmlns:android = "http://schemas.android.com/apk/res/android" android:interpolator = "@anim/动画ID"android:fromDegrees = "0" android:toDegrees = "360"android:pivotX = "200%"android:pivotY = "300%" android:duration = "5000"android:repeatMode = "restart"android:repeatCount = "infinite"/>9. enum:枚举值。(1)属性定义:<declare-styleable name="名称"><attr name="orientation"><enum name="horizontal" value="0" /><enum name="vertical" value="1" /></attr>            </declare-styleable>(2)属性使用:<LinearLayoutxmlns:android = "http://schemas.android.com/apk/res/android"android:orientation = "vertical"android:layout_width = "fill_parent"android:layout_height = "fill_parent"></LinearLayout>10. flag:位或运算。(1)属性定义:<declare-styleable name="名称"><attr name="windowSoftInputMode"><flag name = "stateUnspecified" value = "0" /><flag name = "stateUnchanged" value = "1" /><flag name = "stateHidden" value = "2" /><flag name = "stateAlwaysHidden" value = "3" /><flag name = "stateVisible" value = "4" /><flag name = "stateAlwaysVisible" value = "5" /><flag name = "adjustUnspecified" value = "0x00" /><flag name = "adjustResize" value = "0x10" /><flag name = "adjustPan" value = "0x20" /><flag name = "adjustNothing" value = "0x30" /></attr>         </declare-styleable>(2)属性使用:<activityandroid:name = ".StyleAndThemeActivity"android:label = "@string/app_name"android:windowSoftInputMode = "stateUnspecified | stateUnchanged | stateHidden"><intent-filter><action android:name = "android.intent.action.MAIN" /><category android:name = "android.intent.category.LAUNCHER" /></intent-filter></activity>注意:属性定义时可以指定多种类型值。(1)属性定义:<declare-styleable name = "名称"><attr name = "background" format = "reference|color" /></declare-styleable>(2)属性使用:<ImageViewandroid:layout_width = "42dip"android:layout_height = "42dip"android:background = "@drawable/图片ID|#00FF00"/>

Android之自定义属性,format详解相关推荐

  1. Android自定义属性 format详解

    原文地址:http://blog.csdn.net/pgalxx/article/details/6766677 1. reference:参考某一资源ID. (1)属性定义: <declare ...

  2. Android自定义属性,format详解

    1. reference:参考某一资源ID. (1)属性定义: <declare-styleable name="名称"><attr name="bac ...

  3. android Camera2 API使用详解

    原文:android Camera2 API使用详解 由于最近需要使用相机拍照等功能,鉴于老旧的相机API问题多多,而且新的设备都是基于安卓5.0以上的,于是本人决定研究一下安卓5.0新引入的Came ...

  4. android 支付宝sdk接入详解

    android 支付宝sdk接入详解 第一步 在接入支付宝sdk之前首先要进入支付宝开发者平台申请应用所需要的应用唯一标识(APPID).应用私钥(APP_PRIVATE_KEY).支付宝公钥(ALI ...

  5. android hid 编程,Android Bluetooth HID完成详解,androidhid

    Android Bluetooth HID完成详解,androidhid Android Bluetooth HID落实详解 Android 关于蓝牙的局部运用的是BlueZ协定栈.然而直到眼前2.3 ...

  6. Android Bluetooth HID实现详解

    Android Bluetooth HID实现详解 Android 关于蓝牙的部分使用的是BlueZ协议栈.但是直到目前2.3.3都没有扩展HID的profile,只是实现了最基本的Handset和d ...

  7. Android的Logcat命令详解:翻译Enabling logcat Logging

    Android的Logcat命令详解 --翻译Enabling logcat Logging 田海立@CSDN 2011/07/28 Android LOG系统提供了收集和查看系统调试输出的功能.各种 ...

  8. Linux下Android ADB驱动安装详解

    Developing with cocos2d-x for android on Linux http://blog.plicatibu.com/developing-with-cocos2d-x-f ...

  9. Android NFC卡实例详解

    Android NFC卡实例详解 公司最近在做一个NFC卡片的工程,经过几天的时间,终于写了一个Demo出来,在此记录下在此过程中遇到的问题.由于之前本人是做iOS的,Android写起来并不是那么的 ...

  10. android jar 包 意见反馈功能,android重点jar包详解.docx

    android重点jar包详解 深入理解View(一):从setContentView谈起 我们都知道?MVC,在Android中,这个?V?即指View,那我们今天就来探探View的究竟.在onCr ...

最新文章

  1. matlab朴素贝叶斯手写数字识别_基于MNIST数据集实现手写数字识别
  2. 社交网络图挖掘4--三角形计数问题
  3. python3.6.4安装教程-python3.6.4如何安装到树莓派3代
  4. javascript 常用方法
  5. 下列选项中 采用边界值平滑_使用Illustrator中的混合工具创建很有个性的蛋宝宝...
  6. JavaScript的运动——加速运动篇
  7. 数学建模债券投资组合_1998年全国大学生数学建模竞赛题目A题投资的收益和风险.PDF...
  8. HashSet和LinkedHashSet使用
  9. couchbase_适用于具有Couchbase和WildFly的多容器和多主机应用程序的Docker Machine,Swarm和Compose...
  10. 【操作系统】操作系统的生成
  11. 搭建LAMP环境的过程详细总结
  12. 反转单向链表(JAVA)
  13. linux nfs挂载域名,Linux系统挂载NFS的方法
  14. 记一次复杂的正则匹配——匹配但不包含
  15. nodejs实现定时爬取微博热搜
  16. 挑战云主机战:学习使用云端服器象棋云库
  17. SecureCRT免费安装教程
  18. 五.java入门【循环语句】
  19. android模拟器 vt,逍遥安卓模拟器VT模式如何设置?VT模式设置流程图文分享
  20. 【C语言】数据表现形式及基本数据类型

热门文章

  1. 在 .NET 中使用 C# 处理 YAML
  2. 聊聊如何构建一支自驱团队(二)
  3. 记一次EF Core连接MySql、Oracle
  4. 实现.Net程序中OpenTracing采样和上报配置的自动更新
  5. 在Ocelot中使用自定义的中间件(一)
  6. Magicodes.Sms短信库的封装和集成
  7. 被忽略的TraceId,可以用起来了
  8. 动手造轮子:实现简单的 EventQueue
  9. 面对金九银十铜十一你真的准备好了吗?
  10. 使用.NET Core创建Windows服务(二) - 使用Topshelf方式