android中丰富的链接预览 [英] rich link preview in android

查看:21
本文介绍了android中丰富的链接预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,我认为丰富的链接预览(whatsapp 支持它,参考图片)对用户有帮助,但我不知道如何开始.任何关于如何使用的建议/提示这样做会有所帮助.

I am working on an application where I think rich link preview (whatsapp supports it,refer image) will be helpful for users but I am not able to get an idea to start on it.Any kind of suggestion/hint on how to do this will be helpful.

推荐答案

更新这是最新的解决方案

implementation 'io.github.ponnamkarthik:richlinkpreview:1.0.9'

在您的 XML 中

<io.github.ponnamkarthik.richlinkpreview.RichLinkView
    android:id="@+id/richLinkView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkView>

在Java中:

richLinkView = (RichLinkView) findViewById(R.id.richLinkView);
        
        
        
        richLinkView.setLink("https://stackoverflow.com", new ViewListener() {
            
            @Override
            public void onSuccess(boolean status) {
                
            }
            
            @Override
            public void onError(Exception e) {
                
            }
        });

更多款式请访问

GitHub 上的库

旧答案

您可以在 github 上使用这个 Android 链接预览库.为此,只需将存储库添加到您的 build.gradle 文件中

You can use this Android Link Preview library on github. for that just add the repository to your build.gradle file like this

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:1.2.1@aar'

}

您可以从 这里

这篇关于android中丰富的链接预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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