- 浏览: 618801 次
- 性别:
- 来自: 济南
文章分类
- 全部博客 (164)
- android(基础) (81)
- android(进阶) (2)
- android(底层) (7)
- android(面试) (0)
- android(多媒体) (1)
- android(组件学习) (4)
- android(网络相关) (0)
- android(动画) (1)
- android(数据库) (2)
- android(UI样式) (3)
- android(xml) (0)
- android(调试) (14)
- android(环境搭建) (7)
- android(api) (1)
- C++ (1)
- C (0)
- JavaSE (2)
- Objective-c (1)
- JavaScript (0)
- 设计模式 (0)
- eclipse (3)
- javaee (4)
- 其它 (5)
- linux (18)
- Oracle (1)
- mysql (1)
- 嵌入式linux (1)
- 版本控制工具 (3)
- web前端 (1)
- python (1)
最新评论
-
chungehenyy:
android颜色对应的xml配置值,颜色表 -
u011467537:
...
android中用Spannable在TextView中设置超链接、颜色、字体 -
SurpriseLee:
不能更赞了!
android颜色对应的xml配置值,颜色表 -
u012094586:
这个代码是不是不全呀,能不能提供完整版的给予参考呢?xiexi ...
Android VideoView如何播放RTSP的流 -
luechenying:
顶上天!!!!!!!!!!!!!!!!!!
android颜色对应的xml配置值,颜色表
1. reference:参考某一资源ID。
(1)属性定义:
<declare-styleable name = "名称">
<attr name = "background" format = "reference" />
</declare-styleable>
(2)属性使用:
<ImageView
android: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)属性使用:
<TextView
android:layout_width = "42dip"
android:layout_height = "42dip"
android:textColor = "#00FF00"
/>
3. boolean:布尔值。
(1)属性定义:
<declare-styleable name = "名称">
<attr name = "focusable" format = "boolean" />
</declare-styleable>
(2)属性使用:
<Button
android: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)属性使用:
<Button
android: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)属性使用:
<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 = "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.MapView
android: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)属性使用:
<rotate
xmlns: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)属性使用:
<LinearLayout
xmlns: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)属性使用:
<activity
android: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)属性使用:
<ImageView
android:layout_width = "42dip"
android:layout_height = "42dip"
android:background = "@drawable/图片ID|#00FF00"
/>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/mayingcai1987/archive/2011/03/01/6216655.aspx
(1)属性定义:
<declare-styleable name = "名称">
<attr name = "background" format = "reference" />
</declare-styleable>
(2)属性使用:
<ImageView
android: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)属性使用:
<TextView
android:layout_width = "42dip"
android:layout_height = "42dip"
android:textColor = "#00FF00"
/>
3. boolean:布尔值。
(1)属性定义:
<declare-styleable name = "名称">
<attr name = "focusable" format = "boolean" />
</declare-styleable>
(2)属性使用:
<Button
android: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)属性使用:
<Button
android: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)属性使用:
<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 = "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.MapView
android: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)属性使用:
<rotate
xmlns: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)属性使用:
<LinearLayout
xmlns: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)属性使用:
<activity
android: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)属性使用:
<ImageView
android:layout_width = "42dip"
android:layout_height = "42dip"
android:background = "@drawable/图片ID|#00FF00"
/>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/mayingcai1987/archive/2011/03/01/6216655.aspx
发表评论
-
Fragment 横竖屏切换问题
2013-04-24 14:41 1797在默认情况下当发生横 ... -
Android EditText 增加自定义过滤
2012-02-19 22:20 2395在Android中,可以通过对EditText设置setFil ... -
解决android textview自动换行问题
2012-02-16 11:46 10601今天忽然发现android项目中的文字排版参差不齐的情况非常严 ... -
通过adb命令获取Android手机的IP地址
2011-12-30 19:11 4335要获取Android手机的IP地址,必须先保证你的Androi ... -
Android 图形用户界面 之 绘图(二) Paint类 主要方法介绍
2011-12-30 09:10 1430/** * Paint类介绍 * * Pa ... -
ListView底部分隔线的问题
2011-12-20 14:42 4294在工作中遇到了一个难题,就是一个listView在最下面的一个 ... -
android获取手机上的图片和视频缩略图thumbnails
2011-11-03 22:05 10010转贴自:http://www.android123.com.c ... -
Activity中使用AIDL让Service与Activity通信
2011-10-25 00:06 2762简易计算器,默认执行1+1的计算,点击go按钮执行计算,先看效 ... -
Android图形报表之AchartEngine(附开发包+API文档)
2011-10-22 16:49 11334统计报表: Java4Less (http://java4le ... -
android中用Spannable在TextView中设置超链接、颜色、字体
2011-10-21 23:08 50420昨晚研读 ApiDemo 源码至 com.example.an ... -
android动态设置TextView字体颜色
2011-10-21 11:50 6423最近写程序就遇到了这么个难题,在TextView 上,正常字体 ... -
layer-list和include的使用
2011-10-20 10:14 2388layer-list,include,merge使用,记录一下 ... -
自定义AlertDialog样式,根据屏幕大小来显示
2011-10-19 12:43 4558先介绍一些关于AlertDialog的基本知识: ... -
Android获取屏幕分辨率及DisplayMetrics简介
2011-10-19 08:56 2797Android 可设置为随着窗口大小调整缩放比例,但即便如此, ... -
android资源文件访问android.resource
2011-10-17 09:14 4150android.resource使用转自:http://www ... -
ImageView添加边框
2011-10-16 19:37 2078import android.content.Context; ... -
Android 实现TextView中文字链接的方式
2011-10-16 14:08 2480Android 的实现TextView中文字链接的方式有很多种 ... -
android实现TextView多行文本滚动
2011-10-16 13:38 6380Android中我们为了实现文本的滚动可以在ScrollVie ... -
ListView之setEmptyView的问题
2011-10-15 23:19 4953使用listView或者gridView时,当列表为空时,有时 ... -
去掉TabActivity底部默认白线
2011-10-15 16:38 3259经过一翻百度,google终于实现了TabActivity设置 ...
相关推荐
这篇文章是介绍Android中自定义键盘的一些套路,通过定义一个数字键盘为例,本篇的文章语言是基于Kotlin实现的,如果还没有用或者不熟悉该语言的同学,可以自己补习,我之前也写过入门文章。 效果图 github:源码...
6.4.2 读取来自style和theme中的属性 181 6.5 案例1:圆形ImageView组件 186 6.6 案例2:验证码组件CodeView 190 6.7 练习作业 202 第七章 自定义容器 204 7.1 概述 204 7.2 ViewGroup类 205 7.2.1 ViewGroup常用...
自定义属性都存在于/value/attr.xml文件中,以如下格式存在。 代码如下: ”自定义属性名称”> ”属性名称” format=”属性种类”/> …… 对于自定义属性中的format的值及其含义如下: format属性值:reference 、...
Android 自定义阴影效果详解及实例 Android5.X中,Google为其增加了两个属性 android:elevation=” ” 与 android:translationZ=” “,对应垂直方向上的高度变化。系统会自动增加阴影效果。 在TabLayout中增加...
Android自定义控件属性详细介绍 1. reference:参考某一资源ID。 (1)属性定义: (2)属性使用: <ImageView android:layout_width = 42dip android:layout_height = 42dip
在自定义View时,我们通常会去重写onDraw()方法来绘制View的显示内容。如果该View还需要使用wrap_content属性,那么还必须重写onMeasure()方法。另外,通过自定义attrs属性,还可以设置新的属性配置值。
控件时,难免要用到自定义属性,那怎么使用自定义属性呢? 在文件res/values/下新建attrs.xml属性文件,中定义我们所需要的属性。 <?xml version=1.0 encoding=utf-8?> <resources><!-- resource是跟标签...
有关原理知识请参考Android自定义控件基本原理详解(一)这篇文章。 需求产生背景: 为何要引入自定义属性?当Android提供的原生属性不能满足实际的需求的时候,比如我们需要自定义圆形百分比半径大小、圆形背景...
在自定义View中读取布局文件中的自定义属性 (2)onMeasure 测量 child 即测量主按钮以及菜单项 (3)onLayout 布局 child 即布局主按钮以及菜单项 (4)设置主按钮的选择动画 a.为菜单项menuItem添加平移...
先来看看progressbar的属性: 代码如下: <ProgressBar android:id=”@+id/progressBar” style=”?android:attr/progressBarStyleHorizontal” android:layout_width=”match_parent”
对应博客讲解地址:android自定义控件_深度解析自定义属性 http://blog.csdn.net/yezhuAndroid/article/details/79418570
大家也可以结合《理解Android中的自定义属性》这篇文章进行学习,后续一篇还有应用。 1、attrs文件编写 <?xml version=1.0 encoding=utf-8?> <resources> <attr name=titleTextSize format=dimension>...
详解Android自定义控件属性 可以看到QQ上的ToolBar其实就是一个自定义的view,可以看到不同的界面就是简单地修改了文字而已,在第二张与第三张尤其的明显,我们就仿QQ的这个Toolbar设置一个自定义控件 在开始之前,...
前两篇介绍了自定义控件的基础原理Android自定义控件基本原理详解(一)、Android自定义控件之自定义属性(二)。今天重点介绍一下如何通过自定义组合控件来提高布局的复用,降低开发成本,以及维护成本。 使用...
很多的Android入门程序猿来说对于Android自定义View,可能都是比较恐惧的,但是这又是高手进阶的必经之路,所有准备在自定义View上面花一些功夫,多写一些文章。先总结下自定义View的步骤: 1、自定义View的属性 2、...
自Android 3.0版本开始,系统给我们提供了一种全新的动画模式,属性动画(property animation),它的功能非常强大,下面这篇文章主要给大家介绍了关于Android使用属性动画如何自定义倒计时控件的相关资料,需要的朋友...