issues with mobile-side layouts
Nowadays mobile devices are diverse, screen sizes vary, and here are a few mobile-side layouts today.1. Width percent layout + px layout.First of all, this layout although I do not use now, but still have seen, this layout if you follow the 750 design plan to do in fact, in the mainstream mobile phone screen display is very good, but if the screen is not mainstream, it shows
controls in a tabular manner, which is not very commonly used.Modify the layout file code as follows:Each addition to a tablerow in the tablelayout means that a column is added to the table, and then each time a control is added to the TableRow, a column is added to the row, and thecontrol in the TableRow cannot specify a width. Android:inputtype= the "Textpassword" property to change the input box to the password input boxThe android:layout_span= "2" property indicates that the control occupie
ExtJS's container component can be set to its display style, its valid values are absolute, accordion, anchor, border, card, column, fit, form and table. Altogether 9 kinds.Several other see: Http://www.sencha.com/deploy/dev/examples/layout-browser/layout-browser.html inside there are detailed examples.· Absolute, as the name implies, locates the display inside the container according to the specified coordinates.This was a simple layout style that allows position items within a container using
Contentoffsetadjustment and Contentsizeadjustment properties.Cocoachina is the world's largest Apple development Chinese community, the official daily time to push a variety of exciting research and development resources and tools, the introduction of app marketing experience, the latest corporate recruitment and outsourcing information, as well as the cocos2d engine, Cocos Studio Development Kit, the latest news and training information. Attention can be the first time to understand the latest
|");
Btn3.setid (3);
Relativelayout.layoutparams lp3 = new Relativelayout.layoutparams (ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
Lp3.addrule (Relativelayout.below, 1);
Lp3.addrule (relativelayout.right_of, 2);
Lp3.addrule (Relativelayout.align_right, 1);
//BTN3 is located below the btn1, right side of the BTN2, and aligned with BTN1 's right (to expand)
Rl.addview (BTN3,LP3);
Button BTN4 = New button (this);
Btn4.settext ("---------
the elements equal width.Next, we add a horizontal spacing constraint for the delete and Cancel buttons, select the Horizontal spacing constraint, modify its constant-bit standard, and modify the relation to greater Than or Equal:In this way, the button looks like the layout shown:As you can see, the buttons in the horizontal mode, look good, but in the vertical mode although there is no overlap, but the last button is not complete the whole word of reality.We can prioritize constraints, with a
; so 3:1:1 Billy shows. Then you will understand why when you set three Layout_weight to 1, 2, and 3, the following effect appears:The third one directly does not show, why? Let's take a look at the above method to calculate it: The system first assigns 3 TextView the width fill_parent they want, which means that each one fills his parent control, and here the width of the dead screen so this time the remaining space = 1 parent_width-3 parent_width=-2 a parent_width (parent_ Width refers to scr
control, preferably not. android:layout_weight= "1" represents the layout weight with the sibling control, if two are 1 that is one half, the number of large occupy more space -Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Tools:context=". Mainactivity "> LinearLayoutandroid:orientation= "vertical"Android:layout_width= "Match_parent"Androi
1) fill_parentSetting the layout of a component to fill_parent will force the component to expand to fill as much space as possible within the layout unit. This is roughly the same as the DockStyle property of Windows controls. Setting a top layout or control for Fill_parent will force it to fill the entire screen.2) wrap_contentSetting the size of a view to Wrap_content will force the view to expand to show the entire content. Take the TextView and ImageView controls as an example, set to Wrap_
, and then set the negative margins in the. Sub and. Extra to display the contents of the middle .}#bd {padding:0 190px 0 190px; //Set the padding in . BD, and then set the negative margins in the. Sub and. Extra to display the contents of the middle .Background-color: #ff0;Overflow:hidden; Settings beyond content hiding, etc.}#ft {width:100%;height:100px;Background-color: #5880F4;}EffectWhat to look at---------------------------------------------dividing line----------------------------------
Responsive and adaptive principles are similar, are detection devices, depending on the device with different CSS, and the CSS is used as a percentage, rather than a fixed width.The difference is that the responsive template looks different on the device and changes the presentation style as the device changes.And adaptive does not, all devices appear to be a set of templates, but the length or image is smaller, not according to the device with different display style.Flow is the use of some set
= (Button) Layout.findviewbyid (R.ID.BTN);
Btn.setbackgroundcolor (Color.cyan);
//Display
Setcontentview (layout);
}
}
In addition, Getsystemservice is a method in activity that obtains the corresponding service object based on the name passed in, and these service name parameters are constants in the context class:Description of the object returned by the incoming nameWindow_service WindowManager managing open Windows programsLayout_inflater_service Layoutinflater Gets the view def
the size of the container according to the screen resolution, the position of each container is proportional, the relative position will not change;Responsive layout: The container element adjusts the position according to the screen resolution, the size of each container according to different screen resolution according to different proportions distribution;Static layout: The size and position of the container element is fixed.More Professional Description: http://blog.csdn.net/iefreer/articl
This example and the preceding LinearLayout Android ApiDemos example resolution (145): Views-> Layouts-> LinearLayout-> 5. simple Form implements the same function to construct an input Form, but this example uses the RelativeLayout layout. During actual development, you can decide which layout to use.
Android: layout_width = "match_parent"Android: layout_height = "wrap_content"Android: background = "@ drawable/blue"Android: padding = "10dip">
TextVie
size. Inline elements are different, and by default the contents of the mid-term are arranged, and their shapes are displayed. Another block element adds a newline between the front and the back, which means that the block element is displayed by default (unless we set a float or use a displacement to change its initial position), and through the display property, we can set the state of the element to be displayed;Display:block; /* element is displayed as a block element */ Display:block; /* e
This article introduces to you about the CSS implementation of the three-column layout of three ways (with code), there is a certain reference value, the need for friends can refer to, I hope to help you.
Floating layouts
Divided into three Div, the other parent contains the three Div, using float,
Note points: Three div,left---Right---> center in this order
Flex
Set the middle box flex:1 so that you can adapt to the default horizontal arrangement
This article introduces you to what is the concept of multi-column layout? CSS multi-column layout of the application (instance code), there is a certain reference value, the need for friends can refer to, I hope to help you.
Multi-column Layouts
CSS3 can image text content in a newspaper-like multi-column layout, as in the following example:
The code is as follows (the specific explanation is also in the code)Browser supportThe number in the table
in the parent layout7. Android:layout_centerinparent is centered in the parent layoutIv. Absolute layout of absolutelayout1. android:layout_x Specifies the x-axis coordinates of the control in the parent layout2. android:layout_y Specifies the y-axis coordinates of the control in the parent layoutV. Framelayout Frame LayoutFrame layouts Each added control is displayed at the top, and the last one displayed on the interface is the last control addedVi
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.