Android 在xml中配置 float 和 integer 值
一、float的配置方法
andriod 默认不支持float型的设置,在values 下的新建floats.xml 文件,在内部添加如下代码:
<resources>
<item name="chart_view_line_width" format="float" type="dimen"> 3.3</item>
<item name="chart_view_text_size" format="float" type="dimen">17</item>
</resources>
在代码中的使用方法是:
r.setLineWidth(Float.parseFloat(mContext.getResources().getString(R.string.chart_view_line_width)));
r.setChartValuesTextSize(Float.parseFloat(mContext.getResources().getString(R.string.chart_view_text_size)));
二、integer的配置方法
android 默认支持integer形的设置,在values下新建integers.xml文件,如下:
<resources>
<integer name="emotion_columm_num">14</integer>
<integer name="right_icon_visibility">0</integer>
<integer name="webview_fix_height">65</integer>
<integer name="right_icon_orientation">1</integer>
<integer name="dashboard_flip_interval">4000</integer>
<integer name="pairing_duration">100</integer>
</resources>
代码中使用是:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/select"
android:oneshot="false" > <item
android:drawable="@drawable/pairing_01"
android:duration="@integer/pairing_duration"/>
<item
android:drawable="@drawable/pairing_02"
android:duration="@integer/pairing_duration"/>
<item
android:drawable="@drawable/pairing_03"
android:duration="@integer/pairing_duration"/> </animation-list>
mContext.getResources().getInteger(R.integer.columns);
Android 在xml中配置 float 和 integer 值的更多相关文章
- 在web.xml中配置error-page
在web.xml中配置error-page 在web.xml中有两种配置error-page的方法,一是通过错误码来配置,而是通过异常的类型来配置,分别举例如下: 一. 通过错误码来配置error ...
- web.xml中配置log4j
1.将 commons-logging.jar和 log4j.jar加入你的项目中:2.在src/下创建log4j.properties|log4j.xml文件:3.在web.xml中配置log4j的 ...
- web.xml中配置Spring中applicationContext.xml的方式
2011-11-08 16:29 web.xml中配置Spring中applicationContext.xml的方式 使用web.xml方式加载Spring时,获取Spring applicatio ...
- SSH整合,applicationContext.xml中配置hibernate映射文件问题
今天在applicationContext.xml中配置sessionFactory时遇到了各种头疼的问题,现在总结一下: 1.<property name="mappingDirec ...
- web.xml 中配置了error-page但不起作用问题
问题: 在web.xml 中配置了 error-page,但是好像不起作用,就是跳转不到指定的页面. 配置信息如下: <!-- 400错误 --> <error-page> & ...
- 源码跟读,Spring是如何解析和加载xml中配置的beans
Spring版本基于: 跟踪代码源码基于: https://github.com/deng-cc/KeepLearning commit id:c009ce47bd19e1faf9e07f12086c ...
- struts2 在 Action 或 Interceptor 中获取 web.xml 中配置的 <context-param> 参数 (这是我的第一篇博文,哈哈。)
最近为了改一个问题,想加一个控制开关,就在web.xml 中配置了一个 <context-param> 参数,并在 Action 或 Interceptor 中获取参数值. 1.在 web ...
- 在web.xml中配置监听器来控制ioc容器生命周期
5.整合关键-在web.xml中配置监听器来控制ioc容器生命周期 原因: 1.配置的组件太多,需保障单实例 2.项目停止后,ioc容器也需要关掉,降低对内存资源的占用. 项目启动创建容器,项目停止销 ...
- 在哪个web.xml中配置welcome页面
是在tomcat的web.xml中配置,而不是在你的%web-project-root%/WEB-INF/web.xml中! 示例 <welcome-file-list> <welc ...
随机推荐
- Android 开发必备
Android 开发必备 http://www.androiddevtools.cn/ 收集整理Android开发所需的Android SDK.开发中用到的工具.Android开发教程.Android ...
- [转]正确使用SQLCipher来加密Android数据库 - 朝野布告
参考文档:http://www.tuicool.com/articles/eYNFbuA Android本身自带有不加密的数据库SQLite,如果要保存密码之类的敏感数据在本地的话方法一是使用字段加密 ...
- Linq To Object
//SelectMany List<List<int>> Numbers = new List<List<int>>() { new List<i ...
- phpcms开启、关闭在线编辑模板的方法
打开 caches/configs/system.php 文件 找到 'tpl_edit'=> 0,//是否允许在线编辑模板 修改此行代码中的数字为 1或0 即可
- div+css实现各种形状(精心整理)
1.正方形.div {width: 100px;height: 100px;background: red;} 2.矩形.div {width: 200px;height: 100px;backgro ...
- SQL语句汇总(一)——数据库与表的操作以及创建约束
首先,非常感谢大家对上篇博文的支持,真是让本菜受宠若惊,同时对拖了这么久才出了此篇表示抱歉. 前言:此文旨在汇总从建立数据库到联接查询等绝大部分SQL语句.SQL语句虽不能说很多,但稍有时间不写就容易 ...
- Html5文件
HTML5 file api 读取文件MD5码 http://www.zhuwenlong.com/blog/52d6769f93dcae3050000003
- Css3图标库
最近在研究icon font图标字库,觉得很有意思,于是找了一些比较好的在线字库.大都是开源的,而且各有特色,推荐给大家! 阿里icon font字库 http://www.iconfont.cn/ ...
- fancybox,Ckeditor,jscrollpane 笔记串烧
有用到一些插件,整理了一些笔记,分享一下. 一.Fancybox 很酷很强大的弹窗插件 官网地址:Fancybox,基于jquery,开源协议是GPL和MIT. 主要的特点是:能展示图片,html元素 ...
- [异常] MyEclipse Deploy点不开 An internal error occurred during: "Launching MVC on Tomcat 6.x". java.lang.NullPointerException
>_<" 今天做struts时,工程写好了,可是点击MyEclipse上面的Delopy不会跳出常规的窗口,导致各种坑~ >_<" 如果直接运行还出现下面的 ...