안드로이드 페이스북 카카오톡 로그인 버튼 크기 조절 질문입니다.
조회수 2839회
<Button
android:id="@+id/btLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sky_btn"
android:text="@string/login"
android:textColor="@color/white"/>
<com.facebook.login.widget.LoginButton
android:id="@+id/btFacebook"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingBottom="15dp" />
<com.kakao.usermgmt.LoginButton
android:id="@+id/btKakao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
이런식으로 일반로그인버튼 + 카카오 + 페이스북 로그인 버튼 3개가있습니다.
카카오, 페이스북 버튼은 가중치가 안되더라구요
이 3개의 크기를 동일시 하려면 어떤방법을 써야하나요? 도움 부탁드립니다
-
(•́ ✖ •̀)
알 수 없는 사용자
1 답변
-
weight 속성을 먹이려면 LinearLayout 안에 감싸져 있어야 합니다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" <Button android:id="@+id/btLogin" android:layout_width="0dp" android:layout_height="wrap_content" android:background="@drawable/sky_btn" android:text="@string/login" android:textColor="@color/white" android:layout_weight="1"/> <com.facebook.login.widget.LoginButton android:id="@+id/btFacebook" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingTop="15dp" android:paddingBottom="15dp" android:layout_weight="1"/> <com.kakao.usermgmt.LoginButton android:id="@+id/btKakao" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"/> </LinearLayout>
LinearLayout 으로 감싸고 버튼들에 android:layout_width="0dp", layout_weight을= 1 로 동일하게 줘보세요.
-
(•́ ✖ •̀)
알 수 없는 사용자
- 아 위에는 예시로 3개버튼이있다는 보여드리려고 했던거고 가중치 테스트 할때는 리니어로 감싸서 가중치를 줬는데 안되더라구요. 카카오/페이스북 버튼이 가중치가 되는게 맞나요? 알 수 없는 사용자 2016.4.27 16:29
- 페이스북버튼으로는 테스트 안해봤지만 카카오버튼으로 테스트해보니 잘 되었습니다. 알 수 없는 사용자 2016.4.28 10:05
- 제가 올려주신 코드 그대로, vertical로만 바꾸고 width=wrap, height=0dp 로 수정해서 테스트해봤는데 가중치가 전혀 안먹힙니다... 보니까 높이조절이 불가능한듯싶네요 알 수 없는 사용자 2016.5.3 15:54
- vertical 로 바꾸고 테스트 해보았는데도 잘 먹히는데요.;; 높이가 정확하게 3등분 되는거 확인했습니다..혹시 이미지의 문제는 아닐까요? 알 수 없는 사용자 2016.5.3 18:51
-
댓글 입력