2016-10-02 2 views
1

내 앱에 google + 버튼을 추가하고 싶습니다. <com.google.android.gms.plus.PlusOneButton/>레이아웃에 Android Google PlusOneButton을 추가하면 컴파일 오류가 발생합니다.

바이너리 XML 파일 라인 # 31 : 바이너리 XML 파일 라인 # 31 : 오류 팽창 클래스 I 클래스 PlusOneButton이나는 XML 태그를 구현할 수없는 둘 https://developers.google.com/+/mobile/android/recommend

:이 명령을 따라 com.google.android.gms.plus.PlusOneButton

XML

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="16dp" 
    android:paddingStart="16dp" 
    android:paddingRight="16dp" 
    android:paddingEnd="16dp" 
    android:background="@color/primary_light" 
    android:paddingTop="@dimen/custom_margin_top_bottom" 
    android:paddingBottom="@dimen/custom_margin_top_bottom"> 

    <TextView 
     android:id="@+id/nachrichtTv" 
     android:layout_width="match_parent" 
     android:layout_gravity="center" 
     android:gravity="center" 
     android:layout_height="wrap_content" 
     android:textColor="@color/white" 
     android:singleLine="true" 
     android:ellipsize="marquee" 
     /> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <com.google.android.gms.plus.PlusOneButton 

      android:id="@+id/plus_one_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      /> 


    </LinearLayout> 

</LinearLayout> 

답변

0

이3210 당신이 그것을 할 수있는 방법은 다음과 같습니다

에 추가 Gradle을 :

당신의 layout.xml으로
compile 'com.google.android.gms:play-services:7.3.0' 

당신은 추가 버튼 : 마지막에서

<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="wrap_content" 
    android:layout_height="wrap_content" 
    plus:size="standard" 
    plus:annotation="inline" /> 

당신의 PlusOneButton이있는 액티비티 :

PlusOneButton plusOneButton =(PlusOneButton) findViewById(R.id.plus_one_button); 

    plusOneButton.initialize(URL, 0); 
+0

버튼의 디자인이 마음에 들지 않으면 일반 문자를 사용하고 싶습니다. 동작을 어떻게 추가 할 수 있습니까? – XxGoliathusxX