<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"/>
In this way, there are 3 normal login buttons + Kakao + Facebook login buttons.
Kakao and Facebook buttons are not weighted
Which method should I use to equalize these three sizes? I ask for your help me
android
To feed the weight property, it must be wrapped inside the Linear Layout.
<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>
Wrap around Linear Layout and give the buttons the same Android:layout_width="0dp", layout_weight = 1.
© 2024 OneMinuteCode. All rights reserved.