简体   繁体   中英

How to make the buttons align bottom without any space below the buttons

How to align the buttons bottom of the screen.In the layout i have header below scrollview which contains many textviews and edittext and last is the 2 buttons that i want to place it bottom without any space be see at the bottom as i am able to align it bottom but ther is a small space between buttton and the screentween layout and buttons...

以相反的方式进行操作...打开-相对布局* Button1-父底部为真* Button2-父底部为真,Button1的右侧,顶部对齐Button1,底部对齐Button1 *标题-父顶部为真*滚动视图-标题下方和上方Button1关闭-相对布局

You can use android:layout_martin="0dp" to set the margin to zero, but with some Views this isn't enough as the 9Patch being used for the View background has a margin in it as well. In that case you need to both set the margin to zero, and use a different background 9patch.

http://developer.android.com/guide/developing/tools/draw9patch.html

make them in separate layout and and arrange at parent bottom

<LinearLayout            
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"       
     android:layout_alignParentBottom="true">

     <Button
         android:id="@+id/save_content"
         android:layout_width="wrap_content"
         android:text="save"
         android:layout_marginRight="5dp"
         android:textColor="#ffffff"        
         android:textStyle="bold"           
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:layout_height="35dp"
         android:layout_weight="1"/>

     <Button
         android:id="@+id/cancel_content"
         android:layout_width="wrap_content"
         android:layout_height="35dp"      
         android:text="cancel"
         android:textColor="#ffffff"       
         android:textAppearance="?android:attr/textAppearanceMedium"
         android:layout_marginLeft="5dp"
         android:textStyle="bold"
         android:layout_weight="1"/>
 </LinearLayout>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM