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 ...
随机推荐
- Windows 8.1 应用再出发 - 磁贴的更新
本篇和大家一起了解一下Windows 8.1 中磁贴的更新,我们来看看如何利用它做出更好的应用磁贴. 首先我们从展现形式上来对比一下Windows 8 与 Windows 8.1 中的磁贴: Wind ...
- fragment的生命周期及其各个周期方法的作用
先上生命周期图: Fragment的生命周期图: 与Activity的生命周期对比图: 由于Fragment是嵌在Activity中使用的,故其生命周期也是依赖于Activity的周期的,或者说Fra ...
- HTML5 Canvas rect()和strokeRect() 的区别
看到 Canvas rect()和strokeRect()时,发现这俩效果一样.仔细区分后发现: 他们都接受相同的参数,但rect() 只是创建一个矩形,并不绘制,如图: 要看到实际效果需要使用 st ...
- curl+ post/get 提交
//测试 内容 固定为 你好 post $curlPost = 'mobile='.$mobile.'&message='.$message.'&memberId='.$member ...
- (转)【ASP.NET Web API】Authentication with OWIN
概述 本文说明了如何使用 OWIN 来实现 ASP.NET Web API 的验证功能,以及在客户端与服务器的交互过程中,避免重复提交用户名和密码的机制. 客户端可以分为两类: JavaScript: ...
- 第十五章:Android 调用WebService(.net平台)
什么是webservice? Web service是一个平台独立的,低耦合的,自包含的.基于可编程的web的应用程序,可使用开放的XML(标准通用标记语言下的一个子集)标准来描述.发布.发现.协调和 ...
- python os&shutil 文件操作
python os&shutil 文件操作 # os 模块 os.sep 可以取代操作系统特定的路径分隔符.windows下为 '\\' os.name 字符串指示你正在使用的平台.比如对于W ...
- [游戏模版13] Win32 透明贴图 主角移动
>_<:just add previous two ways to achieve this new result // stdafx.h : include file for stand ...
- C++开源代码覆盖率工具OpenCppCoverage介绍(Windows)
关于代码覆盖率统计工具,Linux平台下,gcc内置支持gcov,通过编译时加参数选项,进行代码插桩,从而实现代码覆盖率.在Windows平台下,早在几年前,我还没找到特别好用又开源的覆盖率工具,所以 ...
- Firefox SVG getBBox方法返回'NS_ERROR_FAILURE'错误分析
在SVG中,我们无法给Text元素设置Width和Height属性,因此无法直接获取Text元素的高和宽.如果想要给Text元素添加背景色,最简单的办法就是在Text元素的下面添加Rect,然后给Re ...