实验4 颜色、字符串资源的使用

课程名称

基于Android平台移动互联网开发

实验日期

2015.3.25

实验项目名称

实验4 颜色、字符串资源的使用

实验地点

S30010

实验类型

□验证型    √设计型    □综合型

学    时

2

一、实验目的及要求(本实验所涉及并要求掌握的知识点)

1,掌握Android中颜色和字符串资源的使用方法。

2,理解Android中尺寸和布局资源的使用方法。

二、实验环境(本实验所使用的硬件设备和相关软件)

(1)PC机

(2)操作系统:Windows XP

(3)软件: Eclipse, JDK1.6,Android SDK,ADT

三、实验内容及步骤

      
  1. 创建工程
  2.   
  3. 修改字符串资源
  4.   
  5. 新建颜色资源color.xml
  6.   
  7. 使用资源颜色和字符串资源
  8.   
  9. 尺寸、布局资源的使用

四、实验结果(本实验源程序清单及运行结果或实验结论、实验设计图)

 

代码:

String.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">shudu</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="main_title">Android shudu</string>
<string name="continue_label">Continue</string>
<string name="new_game_label">New Game</string>
<string name="about_label">About</string>
<string name="exit_label">Exit</string>
<string name="setting_title">Shudu setting</string>
<string name="setting_label">Setting...</string>
<string name="setting_shorcut">Shortcut</string>
<string name="music_title">Music</string>
<string name="music_summary">Play background music</string>
<string name="hints_title">Hints</string>
<string name="hints_summary">Show hints druing play</string>


<string name="new_game_title">Difficulty</string>
<string name="easy_label">Easy</string>
<string name="medium_label">Medium</string>
<string name="hard_label">Hard</string>
<string name="game_title">Game</string>
<string name="no_moves_label">No moves</string>
<string name="keypad_title">Keypad</string>
<string name="about_title">About Android Shudu</string>
<string name="about_text">\
Shudu is a logic-based number placement puzzle.
Starting with a partially completed 9x9 grid, the
objective is to fill the grid so that each
row, each column, and each of the 3x3 boxes
(also called <i>blocks</i>) contains the digits
1 to 9 exactly once.
</string>
<string name="login">登录</string>
<string name="register">注册</string>

</resources>

 

color.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

<color name="background">#ff2f4f4f</color>

<color name="puzzle_background">#ffe6f0ff</color>
<color name="puzzle_hilite">#ffffffff</color>
<color name="puzzle_light">#64c6d4ef</color>
<color name="puzzle_dark">#6456648f</color>
<color name="puzzle_foreground">#ff000000</color>
<color name="puzzle_hint_0">#64ff0000</color>
<color name="puzzle_hint_1">#6400ff80</color>
<color name="puzzle_hint_2">#2000ff80</color>
<color name="puzzle_selected">#64ff8000</color>


</resources>

 

 运行截图:

五、实验总结(对本实验结果进行分析,实验心得体会及改进意见)

整体实验进行的还是很顺利的,因为能够熟练的进行color.xml文件的建造等等,还加了图片,虽然效果一般般,但还是挺不错的。

实验评语

 

实验成绩

 

指导教师签名:              年   月   日

           
posted @ 2016-03-30 11:31  21梁诗琪  阅读(219)  评论(0编辑  收藏  举报