私は自分のAndroidアプリにカスタムFacebook共有ボタンを実装したいと思いますが、これまでのところ私は自分の.xmlファイルにインポートしたその特定のページに対するJavaのアクティビティの使用。カスタムFacebook共有ボタン、Android App
私のコードは(.xml形式で)次のようになります。
<com.facebook.share.widget.ShareButton
android:id="@+id/share_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="Share"
android:layout_centerHorizontal="true"/>
私の.javaでは、onCreate();
private ShareButton shareButton;
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse("https://developers.facebook.com"))
.setContentTitle("MyTitle")
.build();
inside onCreate();
shareButton = (ShareButton)findViewById(R.id.share_btn);
shareButton.setShareContent(content);
XMLにインポートしたカスタムボタンを使用するにはどうすればよいですか? .setShareContentを使用することは明らかにShareButtonのインスタンスではない場合は機能しません。前もって感謝します!
は見つかりましたか?私も同じ状況で立ち往生しています。 –