如何添加到我的Android应用程序一个按钮,而不是像Facebook页面?

时间:2013-07-11 14:27:15

标签: android facebook button facebook-like

我试过这个:https://github.com/crowjdh/android-facebook-like-button-integration

但它不起作用。 当用户按下我正在开发的Android应用程序按钮时,我搜索比“喜欢”更简单的东西到我的脸书页面。 谢谢

2 个答案:

答案 0 :(得分:7)

使用此库:Facebook Like button for Android。 有detailed manual here

资料来源:https://github.com/shamanland/facebook-like-button

Gradle依赖:

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.shamanland:facebook-like-button:0.1.8'
}

添加类似按钮的最简单方法:

<com.shamanland.facebook.likebutton.FacebookLikeButton
    style="@style/Widget.FacebookLikeButton"
    app:pageUrl="http://blog.shamanland.com/"
    app:pageTitle="Developer's notes"
    app:pageText="This is blog about Android development."
    app:pagePicture="@drawable/ic_launcher"
    />

此视图将在您的布局中绘制:enter image description here

另外还有一些喜欢的盒子。

enter image description here

答案 1 :(得分:-1)

您可以创建一个webview并将按钮放入其中。

您可以尝试这样的事情:

 String url = "http://www.facebook.com/plugins/like.php?layout=standard&show_faces=true&width=80&height=50&action=like&colorscheme=light&href=http://beta.demo.dy/web/service/304.htm";
             //   webview = (WebView) findViewById(R.id.webview);
                webView.loadUrl(url);
                 webView.setWebViewClient(new WebViewClient());
             class LikeWebviewClient  extends WebViewClient
                {
                    public boolean shouldOverrideUrlLoading(WebView view, String url) {
                        view.loadUrl(url);
                        return true;
                    }
                }
相关问题