Java 我的谷歌&x2B;按钮不存在';我什么也不做。为什么?

Java 我的谷歌&x2B;按钮不存在';我什么也不做。为什么?,java,android,google-plus,Java,Android,Google Plus,我集成了Google+按钮,我在我的应用程序中看到了它,但它是“灰色”或白色的,不是红色和白色的,当我点击它时,什么也没有发生。这是我的密码: public class Menu extends Activity implements OnClickListener, ConnectionCallbacks, OnConnectionFailedListener{ private static final int REQUEST_CODE_RESOLVE_ERR = 9000;

我集成了Google+按钮,我在我的应用程序中看到了它,但它是“灰色”或白色的,不是红色和白色的,当我点击它时,什么也没有发生。这是我的密码:

public class Menu extends Activity implements OnClickListener, ConnectionCallbacks,
OnConnectionFailedListener{

    private static final int REQUEST_CODE_RESOLVE_ERR = 9000;

    private ProgressDialog mConnectionProgressDialog;
    private PlusClient mPlusClient;
    private ConnectionResult mConnectionResult;
    private PlusOneButton mPlusOneButton;

    ImageButton exit;


    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        final PlusOneButton mPlusOneButton = new PlusOneButton(this);

        mPlusClient = new PlusClient.Builder(this, this, this).clearScopes()
        .build();
        mPlusOneButton.initialize("https://market.android.com/details?id=" + getPackageName(),
        new OnPlusOneClickListener() {
            @Override
            public void onPlusOneClick(Intent intent) {
                mPlusOneButton.setVisibility(View.INVISIBLE);
                startActivityForResult(intent, 0);
            }
        });

        setContentView(R.layout.menu);

        inicijalizujVars();

    }

    @Override
    protected void onStart() {
        super.onStart();
        mPlusClient.connect();
    }

    @Override
    protected void onStop() {
        super.onStop();
        mPlusClient.disconnect();
    }

    @Override
    public void onConnectionFailed(ConnectionResult result) {
        if (mConnectionProgressDialog.isShowing()) {
            if (result.hasResolution()) {
                try {
                    result.startResolutionForResult(this,
                            REQUEST_CODE_RESOLVE_ERR);
                } catch (SendIntentException e) {
                    mPlusClient.connect();
                }
            }
        }
        mConnectionResult = result;
    }

    @Override
    protected void onActivityResult(int requestCode, int responseCode,
            Intent intent) {
        if (requestCode == REQUEST_CODE_RESOLVE_ERR
                && responseCode == RESULT_OK) {
            mConnectionResult = null;
            mPlusClient.connect();
        }
    }

    private void inicijalizujVars() {
        exit = (ImageButton) findViewById(R.id.imageButtonExit);

        exit.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                finish();
            }
        });
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onResume(){
    super.onResume();
    }


    @Override
    public void onBackPressed()
    {
    super.onBackPressed();
    }

    @Override
    public void onConnected(Bundle arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onDisconnected() {
        // TODO Auto-generated method stub

    }
}
以及我的布局xml中的我的按钮:

<com.google.android.gms.plus.PlusOneButton
            xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
            android:id="@+id/plus"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="30dp"
            android:layout_marginTop="-30dp"
            android:gravity="center"
            plus:annotation="bubble"
            plus:size="tall" />


您使用的是哪个版本的Google Play服务?如果4.0有一个PlusOne按钮的错误,如果你使用4.1客户端,这个问题就会解决。我更改了库,现在它可以工作了。谢谢