(ded4a3e0a) v0.9.0.7
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (Main.xml),
|
||||
an internationalization string table (Strings.xml) and some icons (drawable/Icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
Drawable/
|
||||
Icon.png
|
||||
|
||||
Layout/
|
||||
Main.axml
|
||||
|
||||
Values/
|
||||
Strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, the build action should be set
|
||||
to "AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called
|
||||
"Resource" that contains the tokens for each one of the resources included. For example,
|
||||
for the above Resources layout, this is what the Resource class would expose:
|
||||
|
||||
public class Resource {
|
||||
public class Drawable {
|
||||
public const int Icon = 0x123;
|
||||
}
|
||||
|
||||
public class Layout {
|
||||
public const int Main = 0x456;
|
||||
}
|
||||
|
||||
public class String {
|
||||
public const int FirstString = 0xabc;
|
||||
public const int SecondString = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use Resource.Drawable.Icon to reference the Drawable/Icon.png file, or
|
||||
Resource.Layout.Main to reference the Layout/Main.axml file, or Resource.String.FirstString
|
||||
to reference the first string in the dictionary file Values/Strings.xml.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -0,0 +1,65 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.269
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace $safeprojectname$
|
||||
{
|
||||
|
||||
|
||||
public partial class Resource
|
||||
{
|
||||
|
||||
public partial class Attribute
|
||||
{
|
||||
|
||||
private Attribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Drawable
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int Icon = 2130837504;
|
||||
|
||||
// aapt resource value: 0x7f020001
|
||||
public const int Splash = 2130837505;
|
||||
|
||||
private Drawable()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class String
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f030001
|
||||
public const int ApplicationName = 2130903041;
|
||||
|
||||
// aapt resource value: 0x7f030000
|
||||
public const int Hello = 2130903040;
|
||||
|
||||
private String()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Style
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f040000
|
||||
public const int Theme_Splash = 2130968576;
|
||||
|
||||
private Style()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="Hello">Hello World, Click Me!</string>
|
||||
<string name="ApplicationName">$safeprojectname$</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Splash" parent="android:Theme">
|
||||
<item name="android:windowBackground">@drawable/splash</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user