0

我正在使用Google plus api在我的应用上显示+1按钮。我正在针对最新版Google Play服务(8.3)和Nexus 9(更新为棉花糖和8.3.01谷歌播放服务)进行测试。如何显示新的Google加上一个新的设计

但它仍然显示+1按钮的旧设计。 Old google plus button

如何显示新设计。我使用的布局文件enter image description here

代码:

<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" /> 
+0

你能粘贴相关代码吗?因为这个https://developers.google.com/+/web/+1button/提供最新的按钮 – Actiwitty

+0

对不起,只是为了澄清谈论一个android应用程序。 – g90

+0

你如何在应用程序中设置按钮背景? – Actiwitty

回答

0

您可以检查活动,以确保你有这样初始化它:

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了

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

另外我假设你已经完成了所有这https://developers.google.com/+/mobile/android/getting-started因为你看到了所需的结果。

+0

是的,我已经完成了所有这些步骤。该按钮的功能正常。只是造型很古老。 – g90

+0

然后我想Google还没有更新API的图标。你可以提出一个bug,同时尝试添加一个自定义的android:background来保持你的应用程序更新最新的图标。希望这可以帮助 – Actiwitty

相关问题