我在我的应用程序中有一个Fb登录,共享和类似按钮。所有的都是来自facebook sdk的小部件。所以默认情况下他们有facebook sdk的属性。当用户想分享或喜欢,(虽然没有登录),它会要求登录。那么该动作将被执行。我遵循教程https://developers.facebook.com。Android Facebook SDK按钮呈灰色(不可点击)
其工作正常,用于登录和分享按钮,但像按钮灰显(不可点击)。任何帮助来解决这个问题。
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private ImageButton playBtn, someBtn;
LoginButton loginButton;
LikeView likeViewButton;
ShareButton shareButton;
ShareLinkContent linkContent;
CallbackManager callbackManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initInstances();
initCallbackManager();
shareButton = (ShareButton)findViewById(R.id.share_button);
linkContent = new ShareLinkContent.Builder().setContentUrl(Uri.parse("https://developers.facebook.com")).build();
shareButton.setShareContent(linkContent);
likeViewButton = (LikeView) findViewById(R.id.likeView_button);
likeViewButton.setObjectIdAndType("http://inthecheesefactory.com/blog/understand-android-activty-launchmode/en", LikeView.ObjectType.PAGE);
}
private void initInstances() {
playBtn = (ImageButton) findViewById(R.id.playBtn);
playBtn.setOnClickListener(this);
someBtn = (ImageButton) findViewById(R.id.someBtn);
someBtn.setOnClickListener(this);
loginButton = (LoginButton) findViewById(R.id.login_button);
loginButton.setReadPermissions("public_profile");
}
private void initCallbackManager() {
callbackManager = CallbackManager.Factory.create();
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Log.d("Getting User Details", "Success");
getUserDetails(loginResult);
}
@Override
public void onCancel() {
Log.d("LOGIN_CANCEL", "Cancel");
}
@Override
public void onError(FacebookException error) {
Log.d("LOGIN_ERROR", "Error");
}
});
}
}
我面临同样的问题 – Swapnil
最早推出是灰色的,之后它是可点击的。 idk y? –