# MarkdownView **Repository Path**: chinasoft5_ohos/MarkdownView ## Basic Information - **Project Name**: MarkdownView - **Description**: markdown格式的文本库 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://gitee.com/chinasoft5_ohos/MarkdownView - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-19 - **Last Updated**: 2021-09-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MarkdownView #### 项目介绍 - 项目名称:MarkdownView - 所属系列:openharmony的第三方组件适配移植 - 功能:markdown格式的文本库 - 项目移植状态:主功能完成 - 调用差异:无 - 开发版本:sdk6,DevEco Studio2.2 Beta1 - 基线版本:Release 0.19.0 #### 效果演示 ![效果演示](./printscreen/markdownview.gif "截图1") #### 安装教程 1.在项目根目录下的build.gradle文件中, ``` allprojects { repositories { maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } } } ``` 2.在entry模块的build.gradle文件中, ``` dependencies { implementation 'com.gitee.chinasoft_ohos:markdownview:1.0.0' ...... } ``` 在sdk6,DevEco Studio2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 #### 使用说明 将自定义view添加到XML中,使用方法如下: ```java ``` 完整调用: ```java MyBean myBean = new MyBean(); myBean.setHello("Olá"); myBean.setDiasDaSemana(MyBean.DiasDaSemana.DOMINGO); mMarkdownView = (MarkdownView) findComponentById(ResourceTable.Id_mark_view); mMarkdownView.addStyleSheet(mStyle); //http://stackoverflow.com/questions/6370690/media-queries-how-to-target-desktop-tablet-and-mobile mStyle.addMedia("screen and (min-width: 320px)"); mStyle.addRule("h1", "color: green"); mStyle.endMedia(); mStyle.addMedia("screen and (min-width: 481px)"); mStyle.addRule("h1", "color: red"); mStyle.endMedia(); mStyle.addMedia("screen and (min-width: 641px)"); mStyle.addRule("h1", "color: blue"); mStyle.endMedia(); mStyle.addMedia("screen and (min-width: 961px)"); mStyle.addRule("h1", "color: yellow"); mStyle.endMedia(); mStyle.addMedia("screen and (min-width: 1025px)"); mStyle.addRule("h1", "color: gray"); mStyle.endMedia(); mStyle.addMedia("screen and (min-width: 1281px)"); mStyle.addRule("h1", "color: orange"); mStyle.endMedia(); mMarkdownView.setBean(myBean); mMarkdownView.loadMarkdownFromAsset("markdown1.md"); public static class MyBean { public enum DiasDaSemana { DOMINGO, SEGUNDA, TERCA, QUARTA, QUINTA, SEXTA, SABADO } private String hello; private DiasDaSemana diasDaSemana; public String getHello() { return hello; } public void setHello(String hello) { this.hello = hello; } public DiasDaSemana getDiasDaSemana() { return diasDaSemana; } public void setDiasDaSemana(DiasDaSemana diasDaSemana) { this.diasDaSemana = diasDaSemana; } } ``` #### 测试信息 CodeCheck代码测试无异常 CloudTest代码测试无异常 病毒安全检测通过 当前版本demo功能与原组件基本无差异 #### 版本迭代 - 1.0.0 - 0.0.1-SNAPSHOT #### 版权和许可信息 ``` Copyright 2017-2018 tiagohm Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```