Android makes the control at the bottom of the interface

Source: Internet
Author: User

How Android makes controls at the bottom of the interfaceThere are a number of ways to make the control at the bottom of the interface, and here's what I'll say:First, the LinearLayout layout:With three principles you can easily make the control at the bottom of the interface:1. Outermost parent container linearlayout set height layout_height= "match_parent" 2, the inner layer linearlayout set layout_weight= "1" and layout_height= "0DP" 3, the inner layer linearlayout settings where the control position:android:gravity= "Center|bottom"            The following is a practical example to verify (for example). The layout file code is as follows:                <linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"xmlns:tools= "Http://schemas.android.com/tools"android:layout_width= "Fill_parent"android:layout_height= "Match_parent"android:paddingleft= "@dimen/activity_horizontal_margin"android:orientation= "Vertical"tools:context= ". Mainactivity ">

<textviewandroid:text= "@string/hello_world"android:layout_weight= "0"android:layout_width= "Wrap_content"android:layout_height= "Wrap_content"/>
<linearlayoutandroid:layout_width= "Fill_parent"android:layout_height= "0DP"android:orientation= "Horizontal"android:gravity= "Bottom|center"android:layout_weight= "1" ><edittextandroid:minwidth= "280DP"android:layout_width= "Wrap_content"android:layout_height= "Wrap_content"android:text= "Please enter content"/><buttonandroid:layout_width= "Wrap_content"android:layout_height= "Wrap_content"android:text= "Send"/></LinearLayout></LinearLayout>Note: When using the LinearLayout layout, don't forget to set the ordering of the controls Oh android:orientation This property does not set an error .Second, the Relativelayout layoutThis layout is more flexible and easy to set up, just to add in the control
                 
              This property allows the control to be positioned below the screen.       

Android makes the control at the bottom of the interface

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.