文件最后提交记录最后更新时间
!701 【OpenHarmony】新增Preference * 优化代码 * 优化代码 * 优化代码 * 新增首选项 3 年前
!824 适配901工程 * 修改EngineeringCapability文件缩进格式 * 适配工程 * 适配工程 data/Preferences data/Rdb等 3 年前
!1022 [翻译完成】#I5CXUO * update docs 3 年前
!1022 [翻译完成】#I5CXUO * update docs 3 年前
!964 README整改 * update readme 3 年前
!701 【OpenHarmony】新增Preference * 优化代码 * 优化代码 * 优化代码 * 新增首选项 3 年前
!701 【OpenHarmony】新增Preference * 优化代码 * 优化代码 * 优化代码 * 新增首选项 3 年前
!824 适配901工程 * 修改EngineeringCapability文件缩进格式 * 适配工程 * 适配工程 data/Preferences data/Rdb等 3 年前
README.md

Preferences

Introduction

This sample shows how to alternate between themes using preferences. The display effect is as follows:

Concepts

Preferences: provide capabilities for processing data in the form of key-value (KV) pairs and support lightweight data persistence, modification, and query. In KV pairs, the keys are of the string type, and the values can be of the number, string, Boolean, Array<number>, Array<string>, or Array<boolean> type.

Required Permissions

N/A.

Usage

  1. Touch the switch button on the upper right corner of the title bar, and select the target theme from the screen displayed.

  2. Exit the app and then access it again. The theme before the last exit is displayed.

Constraints

  • This sample can only be run on standard-system devices.

  • This sample is based on the stage model, which is supported from API version 9.

  • DevEco Studio 3.0 Beta3 (Build version: 3.0.0.901, built on May 30, 2022) must be used.