Eur*_*nes 14 android google-plus
以下是XML格式的基本Google+ Android登录按钮:
<com.google.android.gms.common.SignInButton
android:id="@+id/sign_in_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)
在类文档中,它声明您可以将按钮的大小指定为ICON_ONLY,STANDARD AND WIDE.
你是如何使用xml做到这一点的?
以下是如何在XML中执行此操作.
<com.google.android.gms.common.SignInButton
android:id="@+id/sign_in_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:buttonSize="wide"
app:colorScheme="dark"/>
Run Code Online (Sandbox Code Playgroud)
buttonSize =>("wide","standard",icon_only"),colorScheme =>("light","dark")
setSize() 是一个公共方法,请尝试在运行时通过 java as 使用它。
((com.google.android.gms.common.SignInButton)findViewById(R.id.sign_in_button))
.setSize(STANDARD);
Run Code Online (Sandbox Code Playgroud)