我在我的應用程序中有一個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? –