rich link preview in android

前端 未结 3 1583
心在旅途
心在旅途 2021-01-05 05:44

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.

3条回答
  •  攒了一身酷
    2021-01-05 06:36

    Update here is the latest solution

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

    in your XML

    
    
    

    in 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) {
                    
                }
            });
    

    For more styles visit

    Library on GitHub

    Old Answer

    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'
    
    }
    

    you can download a sample application from here

提交回复
热议问题