2016-12-15 45 views
3

enter image description here問題與火力地堡的Android按鍵大小

它的工作好,其他一切都是好的,但Facebook的按鈕的大小並不好。 我試圖用多種方式從xml編輯它,但按鈕尺寸保持不變 任何人都可以請幫助嗎?

  <EditText 
       android:id="@+id/password" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="@string/prompt_password" 
       android:imeActionId="@+id/login" 
       android:imeActionLabel="@string/action_sign_in_short" 
       android:imeOptions="actionUnspecified" 
       android:inputType="textPassword" 
       android:maxLines="1" /> 

      <Button 
       android:id="@+id/forgot_password" 
       android:layout_marginTop="8dp" 
       android:text="@string/forgot_password" 
       android:layout_gravity="end" 
       android:typeface="normal" 
       android:textSize="14sp" 
       style="@style/Widget.AppCompat.Button.Borderless" 
       android:background="@drawable/tw__transparent" 
       android:layout_height="38dp" 
       android:layout_width="130dp" /> 

      <Button 
       android:id="@+id/email_sign_in_button" 
       style="?android:textAppearanceSmall" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="8dp" 
       android:text="@string/action_sign_in" 
       android:background="@drawable/rounded_corners" 
       android:textSize="18sp" /> 
     </LinearLayout> 
     <LinearLayout 
      android:id="@+id/facebook_login" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:gravity="bottom" 
      android:orientation="horizontal"> 

      <com.facebook.login.widget.LoginButton 
       android:id="@+id/facebook_login_button" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 
     </LinearLayout> 
    </LinearLayout> 
</ScrollView> 
<ProgressBar 
    android:id="@+id/login_progress" 
    style="?android:attr/progressBarStyleLarge" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:visibility="gone" /> 

+1

你想增加高度還是減少寬度? – Redman

+0

您可以發佈完整的XML –

+0

提升高度 –

回答

1
 if You can Use Padding Like this so increase size but this in use worst case 

     <com.facebook.login.widget.LoginButton 
       android:id="@+id/facebook_login_button" 
       android:layout_width="match_parent" 
       android:paddingTop="10dp" 
       android:paddingBottom="10dp" 
       android:layout_height="wrap_content"/> 

    <!-- in reguler case customise button with xml 
    in Drawable ic_facebook_button--> 
    <?xml version="1.0" encoding="utf-8"?> 
    <shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="rectangle"> 
     <corners android:radius="32dp" /> 
     <solid android:color="#5476b8" /> 
     <padding 
      android:bottom="5dp" 
      android:left="5dp" 
      android:right="5dp" 
      android:top="5dp" /> 
    </shape> 

//Use in Layout xml 
       <Button 
        android:id="@+id/buttonFacebook" 
        android:layout_width="match_parent" 
        android:layout_height="48dp" 
        android:layout_alignParentBottom="true" 
        android:layout_marginTop="9dp" 
        android:background="@drawable/facebookbutton" 
        android:text="@string/facebook_connect" 
        android:textAllCaps="true" 
        android:drawableLeft="@drawable/ic_facebook" 
        android:textColor="@color/colorWhite" 
        android:textSize="18sp" /> 
+0

謝謝Vasupujy,它幫助 –

+0

如果它會幫助你然後請接受和投票 – vasupujy

+0

他不能投票出去10代表,我會爲他做:) – Redman

0

您可以指定高度

<com.facebook.login.widget.LoginButton 
       android:id="@+id/facebook_login_button" 
       android:layout_width="match_parent" 
       android:layout_height="50dp"/> 

提升高度按規定

+0

我的回答我嘗試了雷德曼但它不工作 –

+0

看看按鈕具有scaleType屬性的,如果是寫這條線 機器人:ScaleType =」 fitxy「 – Redman