Customizing the height of the social network button

时间:2016-04-15 11:06:36

标签: android facebook-login google-login twitter-login

I want to add three social network login button Facebook,Twitter and Google plus in my android App.Good thing is I've add these all the buttons with the functionality but the problem I am facing is how to adjust the height of all these button with same height.I can add padding to adjust the height but I think this will not be the right way to do. If any had faced this issue before and had resolved it before please share with me.

Here is the code I've done so far It looks that height issue is fixed but login texts doesn't appears appropriate.

<RelativeLayout
    android:id="@+id/line_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <View
        android:layout_width="match_parent"
        android:layout_height="@dimen/elevation"
        android:layout_centerVertical="true"
        android:background="@color/grey" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:background="@color/black"
        android:text="OR"
        android:textColor="@color/white" />
</RelativeLayout>

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/line_layout"
    android:layout_centerHorizontal="true"
    android:orientation="vertical">

    <TextView
        android:id="@+id/info_text_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="info here" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize">

        <com.facebook.login.widget.LoginButton
            android:id="@+id/login_button"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            android:paddingBottom="20dp"
            android:paddingTop="20dp" />
    </LinearLayout>

    <LinearLayout
        android:layout_marginTop="@dimen/screen_padding_lr"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize">

        <com.twitter.sdk.android.core.identity.TwitterLoginButton
            android:id="@+id/twitter_login_button"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            android:paddingBottom="10dp"
            android:paddingTop="10dp" />
    </LinearLayout>

    <LinearLayout
        android:layout_marginTop="@dimen/screen_padding_lr"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize">

        <com.google.android.gms.common.SignInButton
            android:id="@+id/sign_in_button"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal" />
    </LinearLayout>

</LinearLayout>

1 个答案:

答案 0 :(得分:0)

您必须使用固定的dp高度,您可以将不同的维度放在不同的值文件夹中以支持多个设备