首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何展示新的Google +一个新的设计

如何展示新的Google +一个新的设计
EN

Stack Overflow用户
提问于 2015-11-20 04:05:41
回答 1查看 78关注 0票数 0

我正在使用Google plus api在我的应用程序上显示+1按钮。我正在构建最新版本的Google play服务(8.3),并在Nexus 9上进行测试(更新为棉花糖和8.3.01 Google play服务)

但它仍然显示了+1按钮的旧设计。

如何显示新设计。

我在布局文件中使用的代码:

代码语言:javascript
复制
<com.google.android.gms.plus.PlusOneButton android:id="@+id/plus_one_button"
            xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:focusable="true"
            android:minHeight="24dp"
            plus:annotation="inline"
            plus:size="medium" />
EN

回答 1

Stack Overflow用户

发布于 2015-11-20 04:34:51

您是否可以检查您的activity,以确保您以这种方式初始化了它:

代码语言:javascript
复制
 private static final int PLUS_ONE_REQUEST_CODE = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mPlusClient = new PlusClient(this, this, this);
    mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);
}

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);
}

其中:- URL是要+1'd的Google页面的地址

  • PLUS_ONE_REQUEST_CODE是打开+1活动时使用的请求代码。该值必须是无符号的16位整数。

另外,我假设您在到达这里之前已经完成了所有这些https://developers.google.com/+/mobile/android/getting-started,因为您正在看到所需的结果。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33813378

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档