首页 技术 正文
技术 2022年11月21日
0 收藏 977 点赞 2,788 浏览 1329 个字

一、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);

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,038
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,524
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,372
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,152
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,785
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,868