-
[코틀린]구글 로그인 버튼 로고가 안보일 때 + 구글 로그인 버튼 텍스트 변경 방법It?/코틀린(Kotlin) 2022. 6. 18. 20:33
흔히 안드로이드스튜디오에서 구글 로그인 버튼을 만들려고 한다면 아래 처럼 코드를 구성 합니다.
<com.google.android.gms.common.SignInButton android:layout_width="200dp" android:layout_height="50dp" android:layout_marginTop="16dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/login"> </com.google.android.gms.common.SignInButton>
그러면 이렇게 나와야하는게 '정상' 이지만
저는 이렇게 구글 G로고가 사라져 있더라고요
그래서 조금 찾다보니 https://github.com/shobhitpuri/custom-google-signin-button
GitHub - shobhitpuri/custom-google-signin-button: A custom SignInButton for Android that supports 'android:text' attribute, curr
A custom SignInButton for Android that supports 'android:text' attribute, currently not supported by Google's original 'SignInButton'. This library also allows to set button the...
github.com
어느분 께서 구글 로그인 양식에 맞게 만들어 두신게 있어서 유용하게 사용 하기로 했습니다.
코드는 이렇게 사용하며
dependencies { implementation 'com.shobhitpuri.custombuttons:google-signin:1.1.0' }
<RelativeLayout ... xmlns:app="http://schemas.android.com/apk/res-auto"> <com.shobhitpuri.custombuttons.GoogleSignInButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="@string/google_sign_up" app:isDarkTheme="true" /> </RelativeLayout>
그럼 저처럼 구글 로고가 안보이던 분들도 보이게 됩니다. 하지만 여기서 끝이 아니라
텍스트를 바꿔준다면
<com.shobhitpuri.custombuttons.GoogleSignInButton android:layout_width="0dp" android:layout_height="40dp" android:layout_centerInParent="true" android:layout_marginTop="16dp" android:text="다음 계정으로 로그인" app:isDarkTheme="true" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/login" />
이렇게 텍스트도 바뀌게 됩니다.
반응형'It? > 코틀린(Kotlin)' 카테고리의 다른 글
안드로이드 스튜디오(Android Studio) 패키지 이름(Package name) 바꾸기 (0) 2022.05.04 파이어베이스 SHA-1 구하는 방법 (안드로이드 스튜디오) (0) 2022.04.29