[英]How should I incorporate Like button in Android App with Facebook sdk 4?
I could only find this page in facebook documentation. 我只能在Facebook文档中找到此页面 。 There are links to it from other pages too. 也有其他页面的链接。 What bugs me is that it is title "Docs/Android SDK/Deprecated/Like Button (Android v3)". 让我感到困扰的是它的标题为“文档/ Android SDK /已弃用/类似按钮(Android v3)”。 Is it really deprecated? 真的过时了吗? If so, what's the v4 of doing it? 如果是这样,那么执行此操作的v4是什么?
Update: I've accepted the answer because it links to the documentation ( Documentation: developers.facebook.com/docs/sharing/android) - I don't know how I missed it. 更新:我已经接受了答案,因为它链接到了文档(文档:developers.facebook.com/docs/sharing/android)-我不知道自己是怎么想的。 However, this is not working for me as I expected :-( I will try to investigate further.. 但是,这对我不起作用,正如我期望的那样:-(我将尝试进一步调查。
The way of doing that is inserting a LikeView into the layout this way: 这样做的方法是将LikeView插入布局:
<com.facebook.share.widget.LikeView
android:id="@+id/like_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
After that you just have to configure the like button as you wish, getting it from the layout like this: 之后,您只需要根据需要配置like按钮,就可以从这样的布局中获取它:
LikeView likeView = (LikeView) findViewById(R.id.like_view);
likeView.setObjectIdAndType(
"https://www.facebook.com/FacebookDevelopers",
LikeView.ObjectType.PAGE);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.