Android自定义属性之format介绍(2)

 

 

首页Linux编程

背景:

阅读新闻

Android自定义属性之format介绍

[日期:2012-05-30]   来源:Linux社区  作者:jindegegesun   [字体:]  

5. float:浮点值。

(1)属性定义:

<declare-styleable name = "AlphaAnimation">

<attr name = "fromAlpha" format = "float" />
                   <attr name = "toAlpha" format = "float" />

</declare-styleable>

(2)属性使用:

<alpha
                   Android: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-rotate

xmlns: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.MapView
                    android:layout_width = "fill_parent"
                    android:layout_height = "fill_parent"
                    android:apiKey = "0jOkQ80oD1JL9C6HAja99uGXCRiS2CGjKO_bc_g"

/>

8. fraction:百分数。

(1)属性定义:

<declare-styleable>
                   <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)属性使用:

<rotate

xmlns: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"

/>

 

Android之用PopupWindow实现弹出listview形式菜单

Linux下的nandflash驱动分析(2)——基于S2C6410平台

相关资讯       Android应用开发 

   

本文评论   查看全部评论 (0)


评论声明

尊重网上道德,遵守中华人民共和国的各项有关法律法规

承担一切因您的行为而直接或间接导致的民事或刑事法律责任

本站管理人员有权保留或删除其管辖留言中的任意内容

本站有权在网站内转载或引用您的评论

参与本评论即表明您已经阅读并接受上述条款

 

 

 

最新资讯

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ppgjw.html