我已经实现了此处概述的 Google+ 一键式 https://developers.google.com/+/mobile/android/recommend .
但是,单击 +1 按钮不会增加计数器,并且共享会共享一个空帖子。我不知道为什么会发生这种情况,我尝试了各种解决方案。
这是我实现该按钮的代码:
private static final int PLUS_ONE_REQUEST_CODE = 0;
//In onCreate():
mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);
@Override
protected void onResume() {
super.onResume();
// Refresh the state of the +1 button each time the activity receives focus.
mPlusOneButton.initialize(url, PLUS_ONE_REQUEST_CODE);
}
这是我的按钮 XML:
<com.google.android.gms.plus.PlusOneButton
xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
android:id="@+id/plus_one_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
plus:size="standard"
plus:annotation="inline" />
最佳答案
此问题的原因是
android:launchMode="singleInstance"
在当前 Activity 的 list 中。
您能否分享您的代码,也许我可以提供帮助。
就我而言,我将代码更改为
android:launchMode="singleTask"
问候
关于java - Android Google +1 按钮问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29860040/