# FortyTwo **Repository Path**: chinasoft5_ohos/FortyTwo ## Basic Information - **Project Name**: FortyTwo - **Description**: 显示多项选择答案的UI库 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-17 - **Last Updated**: 2021-09-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # FortyTwo #### 项目介绍 - 项目名称:FortyTwo - 所属系列:openharmony的第三方组件适配移植 - 功能:显示多项选择答案的UI库 - 项目移植状态:主功能完成 - 调用差异:无 - 开发版本:sdk6,DevEco Studio 2.2 Beta1 - 基线版本:Release 1.0.0 #### 效果演示 ![效果图](https://gitee.com/chinasoft5_ohos/FortyTwo/raw/master/artwork/single_selection.gif) #### 安装教程 1.在项目根目录下的build.gradle文件中, ```gradle allprojects { repositories { maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } } } ``` 2.在entry模块的build.gradle文件中, ```gradle dependencies { implementation('com.gitee.chinasoft_ohos:FortyTwo:1.0.0') ...... } ``` #### 使用说明 There are three key interfaces in this library: - Answer: Contains the actual data to display. - AnswerGroup: Displays multiple AnswerViews and coordinates the user’s interaction with them. - AnswerView: Displays a single answer in the UI along with an identifier (e.g A, B, C, 1, 2, 3 etc.) This section provides a quick overview of the components. For more in depth information, read the Javadoc and have a look at [the example](entry/src/main/java/com/matthewtamlin/fortytwo). ###### Answer Define your answers by implementing the Answer interface or instantating one of the provided implementations. ```java // Directly implement the interface Answer answer1 = new Answer() { public CharSequence getText() { return "incorrect answer"; } public boolean isCorrect() { return false; }; } // Use the PojoAnswer class Answer answer2 = new PojoAnswer("this is the right answer", true); answer2.setText("actually I changed my mind, this answer is wrong too"); answer2.setCorrectness(false); // Use the ImmutableAnswer class Answer answer3 = new ImmutableAnswer("this is definitely the right answer", true); ``` ###### AnswerGroup Display and coordinate multiple answers by adding an AnswerGroup to your layout. The SelectionLimitAnswerGroup is the only provided answer group and it should be flexible enough to meet most needs. Using XML: ```xml