如何在android中创建url预览? [英] How do I create url preview in android?

查看:99
本文介绍了如何在android中创建url预览?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在共享时在android中显示任何URL的预览(就像在facebook或whatsapp中显示的一样).预览必须包含来自网页的图像和链接的简短说明.我曾想从元数据和Favicon中获取信息,但是Favicon的大小很小,并且元数据并不总是存在(例如,在Quora中,您无法在元数据中获取有关问题的信息).对不起,我的英语不好,又说不清楚.

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.

推荐答案

签出此 Android链接预览具有与您想要的功能相同的库.

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

您可以使用Gradle导入库:

You can import the library using Gradle :

只需将存储库添加到您的build.gradle文件:

Simply add the repository to your build.gradle file:

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

您可以使用以下工件:

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

这篇关于如何在android中创建url预览?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆