How do I create url preview in android? [duplicate]

点点圈 提交于 2019-12-07 17:38:13

问题


I want to show preview of any url in android when I share it (like it is shown in facebook or whatsapp). the preview must contain an image from the webpage and small description of the link. I thought of picking up information from metadata and favicon, but favicon is very small in size and metadata is not always present (for example, in Quora u don't get information about the question in the metadata). Sorry for my bad english and lack of clearity.


回答1:


Checkout this Android Link Preview Library which does the same you are seeking for.

You can import the library using Gradle :

Simply add the repository to your build.gradle file:

repositories {
    jcenter()
    maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy' }
}

And you can use the artifacts like this:

dependencies {
    compile 'org.jsoup:jsoup:1.8.3' // required
    compile 'com.leocardz:link-preview:2.0.0@aar'
}


来源:https://stackoverflow.com/questions/34917503/how-do-i-create-url-preview-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!