在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mukeshsolanki/MarkdownView-Android开源软件地址(OpenSource Url):https://github.com/mukeshsolanki/MarkdownView-Android开源编程语言(OpenSource Language):JavaScript 91.3%开源软件介绍(OpenSource Introduction):Compose Markdown View
Supporting Compose Markdown ViewCompose Markdown View is an independent project with ongoing development and support made possible thanks to your donations. Getting startedIts really simple to integrate Markdown in android. All you need to do make the following change to you build gradle under the app module. Step 1. Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories: allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
} Step 2. Add the dependency dependencies {
implementation 'com.github.mukeshsolanki:MarkdownView-Android:2.0.0'
} How to use MarkdownIts fairly simple and straight forward to use Markdown in you application.
Just use MarkDown(
url = URL("https://raw.githubusercontent.com/mukeshsolanki/MarkdownView-Android/main/README.md"),
modifier = Modifier.fillMaxSize()
)
Add a compose view in your xml file like <androidx.compose.ui.platform.ComposeView
android:id="@+id/markdown"
android:layout_width="match_parent"
android:layout_height="match_parent" /> and reference it in your activity/fragment and assign the markdown text/file like wise. val markdown = findViewById(R.id.markdown)
markdown.composeView.apply {
// Dispose of the Composition when the view's LifecycleOwner is destroyed
setViewCompositionStrategy(DisposeOnViewTreeLifecycleDestroyed)
setContent {
// In Compose world
MaterialTheme {
MarkDown(
url = URL("https://raw.githubusercontent.com/mukeshsolanki/MarkdownView-Android/main/README.md"),
modifier = Modifier.fillMaxSize()
)
}
}
} Markdown SourcesYou have 3 different sources from where markdown data can be read
MarkDown(
text = "# Test Markdown",
modifier = Modifier.fillMaxSize()
)
MarkDown(
file = file,
modifier = Modifier.fillMaxSize()
)
MarkDown(
url = URL("https://raw.githubusercontent.com/mukeshsolanki/MarkdownView-Android/main/README.md"),
modifier = Modifier.fillMaxSize()
) AuthorMaintained by Mukesh Solanki Contribution
License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论