1. 图像资源文件(Image)
{
"icon": "resources/rawfile/icon.png",
"background": "resources/rawfile/background.jpg"
}
2. 布局文件(XML)
<!-- resources/base/layout/main_layout.xml -->
<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="match_parent"
ohos:width="match_parent">
<Text
ohos:id="$+id/text_view"
ohos:text="@string/hello_message"
ohos:width="match_parent"
ohos:height="wrap_content"/>
</DirectionalLayout>
3. 字符串资源文件(Values)
<!-- resources/base/values/strings.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ohos="http://schemas.huawei.com/res/ohos">
<string name="app_name">MyApp</string>
<string name="hello_message">Hello, HarmonyOS!</string>
</resources>
4. 样式资源文件(Values)
<!-- resources/base/values/styles.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ohos="http://schemas.huawei.com/res/ohos">
<style name="AppTheme" parent="Theme.Default">
<item name="colorPrimary">#6200EA</item>
<item name="colorAccent">#03DAC5</item>
</style>
</resources>
5. 动画资源文件(Animation)
{
"fade_in": "resources/rawfile/fade_in.xml",
"rotate": "resources/rawfile/rotate.json"
}
6. 音频资源文件(RawFile)
{
"background_music": "resources/rawfile/background_music.mp3",
"notification_sound": "resources/rawfile/notification_sound.wav"
}
这是一个简单的示例,实际应用可能包含更多类型的资源文件,具体内容和结构取决于应用的需求和设计。这些资源文件在应用开发中被引用和使用,为应用提供了图像、布局、字符串、样式、动画和音频等多样化的功能和外观。
转载请注明出处:http://www.zyzy.cn/article/detail/1396/鸿蒙OS