Android ApiDemos example resolution (146): Views-& gt; Layouts-& gt; Line

Source: Internet
Author: User

This example uses LinearLayout to construct an input form and layout_gravity pairs to deploy the button display position.

LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: orientation = "vertical"
Android: background = "@ drawable/blue"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: padding = "10dip">

<! -
TextView goes on top...
->
<TextView
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/linear_layout_5_instructions"/>

<! -
Followed by the EditText field...

Also give it a standard background (the "android :"
Part in @ android: drawable/editbox_background
Means it is system resource rather
An application resource.
->
<EditText
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: background = "@ android: drawable/editbox_background"/>

<! -
Use a horizontal layout to hold the two buttons.
This item has layout_gravity = "right". This means the whole
Horizontal LinearLayout is right aligned, not the individual
Items within it. The horizontal LinearLayout's width is set
Wrap_content. (If it was match_parent it wocould not have any
Room to slide to the right .)
->
<LinearLayout
Android: orientation = "horizontal"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_gravity = "right">

<Button
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "@ string/linear_layout_5_cancel"/>

<Button
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_marginLeft = "10dip"
Android: text = "@ string/linear_layout_5_ OK"/>

</LinearLayout>

</LinearLayout>


 

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.