2016-04-15 8 views
0

Ich möchte drei soziale Netzwerk-Login-Button hinzufügen Facebook, Twitter und Google Plus in meiner Android-App.Gute Sache ist, habe ich diese alle Schaltflächen mit der Funktionalität hinzufügen, aber das Problem, das ich bin Gegenüberstellung ist, wie man die Höhe aller dieser Knöpfe mit der gleichen Höhe justiert. Ich kann Polsterung addieren, um die Höhe zu justieren, aber ich denke, dass dieses nicht der richtige Weg ist zu tun. Wenn jemand dieses Problem zuvor schon einmal gelöst und gelöst hatte, teilen Sie es mir bitte mit.Anpassen der Höhe des sozialen Netzwerks Schaltfläche

Hier ist der Code, den ich bisher gemacht habe Es sieht aus, dass Höhe Problem behoben ist, aber Login-Texte scheint nicht angemessen.

<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

wie etwa feste dp für Höhe Unterstützung für alle Sie? – Pooya

+0

das ist der Grund, warum ich diese Frage gestellt habe. Wenn es den besseren Weg gibt, teilen Sie bitte –

+0

, wenn die übergeordnete Ansicht eine bekannte Höhe hat, dann können Sie Gewichtung verwenden und das Layout die Höhe Ihrer Schaltflächen basierend auf dem verfügbaren Platz festlegen lassen – Pooya

Antwort

0

Sie haben die feste dp Höhe verwenden, können Sie andere Dimension in verschiedenen Wert Ordner platzieren, um mehrere Geräte