基础篇--resources资源

[size=x-large]最近一直在做java开发,偶尔敲点android代码,突然发现有些基础给忘记了,今天用半天时间温顾一下resources的资源。

[color=green]String.xml 字符串资源[/color] 涉及国际化问题
[url]http://www.2cto.com/kf/201302/190394.html[/url]

[color=green]string-array 数组资源[/color][/size]
<ListView  
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:entries="@array/arr" ></ListView>


[size=x-large][color=green]color.xml 颜色资源[/color][/size]
<color name="white">#ffffff</color><!--白色 --> 


[size=x-large][color=green]dimen.xml 尺寸资源[/color][/size]
<dimen name="btn4_width">20dp</dimen>
<dimen name="btn4_height">150dp</dimen>


[size=x-large][color=green]drawable.xml 图片资源[/color]

[color=green]menu.xml 菜单资源[/color]
以前的手机菜单有表格布局,现在手机是纵向的列表格式,[/size]

menu.add(0, Menu.FIRST, 0, "删除").setIcon(R.drawable.menu_delete);//设置图标
menu.add(0, Menu.FIRST+1, 0, "网络").setIcon(R.drawable.menu_test);


[size=x-large]如果要自己现实自己定义的布局,那么就要自己去写布局[/size]

[size=x-large][color=green]assets.xml assets资源[/color]
可以读取assets文件夹中的资源,里面可能涉及图片资源,数据库资源,配置文件资源

[color=green]style.xml 样式资源[/color]
可以用parent直接继承父类里面所有的资源

[color=green]xml.xml xml资源[/color]
解析xml里面的内容,来获取里面的数据

[color=green]视频资源[/color]
1:源文件(即res/raw下或assets下)
2:文件系统(即sdcard)
3:流媒体(即网络)

[color=green]动画样式资源[/color]
res/anim xml存放[/size]
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >

<!-- 定义从左向右进入的动画 -->
<translate
android:duration="500"
android:fromXDelta="-100%"
android:toXDelta="0" />

</set>

[size=x-large]一般style.xml调用


附代码一份,里面有各种资源的代码[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值