To-do listResource example
In this example2ChapterTo-do listExampleProgramAdd new external resources to add some additional functions. The string and image resources created here will be in4Chapter:To-do listIt is used when the application implements the menu.
The next step will show you how to create text andIconResources, and how to create a topic for the application:
1.Create twoPNGTo add or delete items. It is best to estimate the size of each image.16 × 16Pixels, and Graphs3-5Same.
Figure3-5
2.Copy the image to the Project/RES/drawableFolder and update your project. Your engineering hierarchy should be shown in the figure3-6.
Figure3-6
3. open /RES/values string. XML resource file, which is " add_new "," remove "and" cancel " to add a string value. (You can delete the default " Hello " string .)
<? XML version = "1.0" encoding = "UTF-8"?>
<Resources>
<String name = "app_name"> to do list </string>
<String name = "add_new"> Add new item </string>
<String name = "remove"> remove item </string>
<String name = "cancel"> cancel </string>
</Resources>
4.In/RES/ValuesFolder to create a newStyles. xmlFile to create a new topic for the application. Let your topic be based onAndroidStandard topic, but set the default text size value.
<? XML version = "1.0" encoding = "UTF-8"?>
<Resources>
<Style name = "todotheme" parent = "@ Android: style/theme. Black">
<Item name = "Android: textsize"> 12sp </item>
</Style>
</Resources>
5.InManifestApplication topic in the file:
<Activity Android: Name = ". todolist"
Android: Label = "@ string/app_name"
Android: theme = "@ style/todotheme">