Android Layout XML attribute Research--android:layout_marginbottom (reprint)

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/yanfangjin/article/details/7393023

In the following XML configuration file, initially for Android:layout_marginbottom, you need to control ImageButton for the downward spacing, you cannot working.

<relativelayout
Android:id= "@+id/bar"
Android:layout_width= "Wrap_content"
android:layout_height= "Fill_parent"
android:background= "@drawable/IC_BAR_BG"
Android:layout_alignparentright= "true"
android:orientation= "Horizontal" >

<imagebutton
Android:id= "@+id/gallery"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_centerhorizontal= "true"
Android:layout_marginbottom= "10DP"
android:background= "@drawable/ic_frame"/>

</RelativeLayout>

See a lot of blog, for releated layout of the settings have a certain understanding, subsequent testing, added the following settings android:layout_alignparentbottom= "True", you can use layout _marginbottom This feature so that the default setting is assumed, Alignparantbottom is definitely false, so layout_marginbottom does not work.

<relativelayout
        android:id= "@+id/bar"
         android:layout_width= "Wrap_content"
        android:layout_height= "Fill_parent"
        android:background= "@drawable /IC_BAR_BG "
        android:layout_alignparentright=" true "
         android:orientation= "Horizontal";

<imagebutton
Android:id= "@+id/gallery"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_centerhorizontal= "true"
android:layout_alignparentbottom= "true"
Android:layout_marginbottom= "10DP"
android:background= "@drawable/ic_frame"/>

</RelativeLayout>

Android Layout XML attribute Research--android:layout_marginbottom (reprint)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.