Android interview (1)----layout

Source: Internet
Author: User

1. Say the Android v layout and say what it does?

Framelayout: Stacking layouts can also be stacked together. The longest applies to the use of fragment.

LinearLayout: Linear layout, which can be vertical or horizontal.

Releativelayout: Complex pages are generally used, and can be ignored relative to the size of the page.

Absolutlayout: Absolute layout: fixed x, y coordinates.

Tablayout: Used for the tab page.

2.xmlns:android= "Http://schemas.android.com/apk/res/android"

xmlns:android= "Http://schemas.android.com/apk/res/android"     android:layout_width= "Match_parent"    android:layout_height= "Match_parent"     Android:orientation= "vertical" >    <button        android:id= "@+id/btn_start"         Android:layout_width= "Wrap_content"        android:layout_height= "Wrap_content"         Android:text= "@string/start" >    </Button></LinearLayout>

This property defines the namespace for Android resource.

3.linearlayout Split line?

Android 3.0 and above support split line:

Android:showdividerd.

4. How to determine the position of the button on the phone screen?

View.getlocationonscreen (location);

5. How do I use XML to lay out the view in Releativelayout?

You can use Layoutparamters to set it through Layoutparamters.addrule.

How does 6.Tablelayout work?

Tablelayout use TableRow to specify each line, the number of columns in each row can be different.

7. android:stretchcolumns= "2" in Tablelayout

android:stretchcolumns= "2" means the second column will fill the rest of the space.

8. Save the layout as an image!

View.setdrawingcacheenable (TRUE);

View.getdrawingcache ();

9. How do I set the gradient background?

The direction of the color gradient can be defined by the gradientdrawable.orientation in the following eight ways:

mDrawable =  new GradientDrawable(GradientDrawable.Orientation.TL_BR, new int [] {  0xFFFF0000 0xFF00FF00 , 0xFF0000FF });Use the liner,radial and sweep three gradient modes respectively, and with the specified rectangle four corner fillet radius, display different uses of gradientdrawable: mDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT); setCornerRadii(mDrawable, r, r,  0 0 ); mDrawable.draw(canvas);The role of 10.android:layout_weight? The larger the value, the less important it is. If Layout_weight one is 1, one is 2, and width and height are match_parent, 2/3 and 1/311.DP & sp?160dpi = 320*48012.android:layout_ What is the difference between gravity and android:gravity? Android:layout_gravity refers to the position of the view in the parent control, and Android:gravity refers to the location of the content. 12. How do I reuse a layout file? <include android:id= "+ID/LAYOUT1" [e-mail protected]/myloyout>13.merge role? The merge filters out excess layout shells. 14.

Android interview (1)----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.