Android from ignorance to knowledge-No. 3 and androidno.3

Source: Internet
Author: User

Android from ignorance to knowledge-No. 3 and androidno.3

Yesterday I read several common la S, similar to the html I learned previously. I didn't have much contact with css + div, but these la s are relatively simple, the logic can be integrated as long as there are no major problems.

The relative layout is our default layout, which is also the most commonly used. Both the "phone dial" and "SMS transmitter" made in the front are used. This layout emphasizes the relative positions between controls. For example, you can use the id to identify who is under or above, and use the space location relationship to customize the entire UI. Assume that there are two controls, one with the id of TV and the other with the id of xc. To make xc lower than TV, you can use the following statement in xc ---- android: layout_below = "@ id/TV"; it is concise and clear, and can be understood after the English level 3. Of course, in the relative layout, you can adjust the space position of the control by using the variable value, which meets specific requirements with respect to the parent form or setting specific parameter values.

Linear layout is simpler than the former. It is horizontal and vertical, and there is no alignment or alignment. All controls are on the same line. It is usually used in combination with the relative layout, for example, some system settings in our mobile phone, including single-sheet or check boxes for each entry, can all be achieved through the combination of the two.

Table layout, as its name implies, uses columns to design the UI. This is usually used to verify the layout of identity information, such as name, age, gender, and ID card number. It is similar to linear layout, can achieve the same effect.

Absolute layout: layout_x and layout_y are used to determine the position of a widget relative to the form. For example, QQ game happy landlords are implemented through absolute layout. The position of playing cards is determined by specific parameters, but now this layout has been discarded, because the screen size of the android device is large and small. If the absolute position information is used to determine the position of a widget in the form, it is easy to see deviations, so now, the screen width and height are calculated dynamically, and then the specific position of the control is defined by percentage. This is the same as keeping pace with the times.

The last one is the most interesting layout that I think is frame layout. It is like an onion and consists of a layer-by-layer interface. When we watch videos and click pause, a button is usually displayed, which is a small icon. After clicking pause, the video will be played normally. OK. First, the Code is as follows:

<TextView android: layout_width = "match_parent" android: layout_height = "match_parent" android: text = "playing video" android: gravity = "center" android: visibility = "visible"/> <LinearLayout android: layout_width = "fill_parent" android: layout_height = "match_parent" android: orientation = "horizontal"> <Button android: onClick = "play" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "play"/> <Button android: onClick = "pause" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "pause"/> </LinearLayout> <LinearLayout android: layout_width = "match_parent" android: layout_height = "match_parent" android: gravity = "center"> <ImageView android: id = "@ + id/iv" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: src = "@ drawable/ic_launcher" android: visibility = "invisible"/> </LinearLayout>

This code is the four small parts of the simple video playback interface we have made. The three parts are accurate, namely the video prompts and two buttons from top to bottom, there is also a small icon displayed when you pause. This article describes several important parameters: visibility = "visible", which is used to set whether the icon is displayed. We will use it later to set the status of the icons when playing or pausing; src = "@ drawable/ic_launcher", set the image source, which can be defined by yourself; onClick = "pause", set the click event to prepare for the subsequent status display. Next:

 private ImageView iv;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.test_frame);        iv=(ImageView)findViewById(R.id.iv);    }    public void play(View view){    iv.setVisibility(view.INVISIBLE);    }    public void pause(View view){    iv.setVisibility(view.VISIBLE);    }

This defines the status of the small icon when you click the play or pause button. First, you get the icon, and then set to hide the icon when you accept the "play" button, and display the icon when you accept the "pause" button, the final effect is as follows:

The former is the status during playback, and the latter is the status during pause. OK. This is the case today...


Answer: from ignorance to knowledge,

B
 
From ignorance to knowledge, it means not understanding, or being immature to maturity.

From ignorance to ignorance, you can accept some nonsense words with patience.
 

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.