在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):falnatsheh/MarkdownView开源软件地址(OpenSource Url):https://github.com/falnatsheh/MarkdownView开源编程语言(OpenSource Language):CSS 54.0%开源软件介绍(OpenSource Introduction):AboutMarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and style the output using CSS. The MarkdownView itself extends Android Webview and adds the necessary logic to parse Markdown (using MarkdownJ) and display the output HTML on the view. Getting started
dependencies {
compile 'us.feras.mdv:markdownview:1.1.0'
} UsageAdd MarkdownView to your layout: <us.feras.mdv.MarkdownView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/markdownView" /> and reference it in your Activity/Fragment: MarkdownView markdownView = (MarkdownView) findViewById(R.id.markdownView);
markdownView.loadMarkdown("## Hello Markdown"); Note: You could also create the view by code. Below an example of how to set the whole activity to be a MarkdownView by Adding the following to your onCreate method: MarkdownView markdownView = new MarkdownView(this);
setContentView(markdownView);
markdownView.loadMarkdown("## Hello Markdown"); ScreenshotsDemo App and Code SampleThe above screenshots taking from the demo app which could be found here. The demo app include code to demonstrate:
Loading Markdown text or file:
To load a local file, you have to add it to your assets folder and pass a url that start with "file:///android_asset/" : markdownView.loadMarkdownFile("file:///android_asset/myFile.md"); To load a remote file you need to pass the full url : markdownView.loadMarkdownFile("http://www.my-site.com/myFile.md"); ThemingYou could apply custom CSS to the MarkdownView. Example: markdownView.loadMarkdownFile("file:///android_asset/hello.md","file:///android_asset/MyCustomTheme.css"); You could take a look at CSS example here, you could also view them in the sample app. ChangeLog:
LicenseApache 2.0 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论