我有一个博客,每个帖子下面都有一个Facebook like按钮。我想把这个按钮添加到android应用程序中,就像那篇博客文章一样。这可能吗?如果是,那么是怎么做的?
我必须使用Facebook SDK吗?
这是按钮在博客中的显示方式。
<iframe allowTransparency='true' expr:src='"http://www.facebook.com/plugins/like.php?href=" + data:post.canonicalUrl+"&send=false&layout=button_count&show_faces=false&width=90&action=like&font=arial&colorscheme=light&height=21"' frameborder='0' scrolling='no' style='border:none; overflow:hidden; width:90px; height:21px;'/>
试试这个:它为我工作
<com.facebook.widget.LikeView
android:id="@+id/like"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Like"
/>
在android类文件中添加以下代码:
LikeView likeView = (LikeView) findViewById(R.id.like);
likeView.setObjectId("Your URL);