Here are the examples of the java api class com.google.android.gms.plus.PlusOneButton taken from open source projects.
1. LinksCard#init()
Project: narrate-android
File: LinksCard.java
File: LinksCard.java
@Override protected void init() { super.init(); setTitle(R.string.links); ButtonPreference mCommunityLink = new ButtonPreference(getContext()); ButtonPreference mTaskerLink = new ButtonPreference(getContext()); ButtonPreference mGithubLink = new ButtonPreference(getContext()); mCommunityLink.setTitle(R.string.google_plus); mTaskerLink.setTitle(R.string.links_tasker_documentation); mGithubLink.setTitle(R.string.links_github); mCommunityLink.setButtonText(R.string.go); mTaskerLink.setButtonText(R.string.go); mGithubLink.setButtonText(R.string.go); mCommunityLink.setTag("community"); mTaskerLink.setTag("tasker"); mGithubLink.setTag("github"); mCommunityLink.setOnClickListener(this); mTaskerLink.setOnClickListener(this); mGithubLink.setOnClickListener(this); plusOneButton = new PlusOneButton(getContext()); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT); lp.addRule(RelativeLayout.CENTER_VERTICAL); lp.leftMargin = getResources().getDimensionPixelOffset(R.dimen.default_height) * 3; plusOneButton.setLayoutParams(lp); mCommunityLink.addView(plusOneButton); addView(mGithubLink); addView(mCommunityLink); addView(mTaskerLink); }