I am having G+ signinbutton in my code and its working fine for login. I set it using below code in my xml
<com.google.android.gms.common.SignInButton
android:id="@+id/btn_sign_in"
android:layout_width="match_parent"
android:layout_height="50dp"
android:textSize="15dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
/>
What I have now is as below
Now I want to set TextView to center of button. but, SignInButton doesn't seem to have android:gravity
how can I set my TextView to center?
@Karan - use below code
, it's working for me.
SignInButton signInButton = ((SignInButton) findViewById(R.id.btn_sign_in));
for (int i = 0; i < signInButton.getChildCount(); i++) {
View v = signInButton.getChildAt(i);
if (v instanceof TextView) {
TextView tv = (TextView) v;
tv.setPadding(0, 0, 20, 0);
return;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With