Android-How to align at bottom left, align, right three buttons picture skillfully with relative Layout

Source: Internet
Author: User

Relative Layout You can specify a positional relationship between elements of a sibling (e.g. Layout_toleftof) You can also specify a positional relationship between child elements and parent elements (e.g. Layout_alignparentleft left-justified relative to the parent element) This makes it easy to align the picture at the bottom of the screen.

The code is as follows:

<?xml version= "1.0" encoding= "Utf-8"?>
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:orientation= "Vertical"
android:divider= "@drawable/line"
android:showdividers= "Middle" >

<!--news Content--
<webview
Android:id= "@+id/web"
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
android:layout_weight= "1" >

</WebView>

<!--bottom picture--
<relativelayout
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
Android:layout_margin= "10DP"
>

<imagebutton
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_gravity= "Center_horizontal"
android:layout_marginleft= "10DP"
Android:layout_alignparentleft= "true" <! --left-justified in parent element
android:background= "@drawable/back"/>

<imagebutton
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_gravity= "Center_horizontal"
Android:layout_centerinparent= "true" <! --center-align in parent element
android:background= "@drawable/house"/>

<imagebutton
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:background= "@drawable/share"
Android:layout_alignparentright= "true" <! --right-justified in the parent element
android:layout_marginright= "10DP"
Android:layout_gravity= "Center_horizontal"
/>

</RelativeLayout>


</LinearLayout>

Android-How to align at bottom left, align, right three buttons picture skillfully with relative Layout

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.