Java-Android Learning (Day 5)

Source: Internet
Author: User

Java-Android Learning (Day 5)
Android layout picking + page Jump 1. Android layout picking

In the past two days, we will supplement the interface layout (which may be supplemented in the future ):

A) ScrollView

ScrollView refers to the view that needs to be displayed through the scroll axis when there is a lot of content and the screen is not fully displayed; ScrollView only supports vertical scrolling;

This view is a good choice for a large number of bar-level columns.

B) View

If we want to divide a region into different sub-regions, and there is an obvious split between regions (either a split line or a highly split area ),

Use It is a good choice. The example is as follows:

Android: layout_width = "fill_parent"
Android: layout_height = "20sp" // sets the height, indicating the height of the grayscale area. When the value is set to 1sp, the line character is displayed, with a separator effect.
Android: layout_marginTop = "14sp"
Android: background = "# fff7f7f7"/>

Ii. page Jump

In general, the following process is taken into account to achieve page Jump:

A) add a click event to the control.

Scenario: There are two interfaces, A and B. There is A Button btn in interface A. You need to click btn to jump to interface B.

In the class that implements Activty (sometimes OnClickListener may be implemented to distinguish different controls,

① Define a private Button btnTZ = null;

② In the onCreate method, btnTZ = (Button) findViewById (R. id. btnTZ); get the ing object of the Button;

③ Associate the Click Event listener of the button with the specific implementation method:

                   btnTZ.setOnClickListener(this);
Public void onClick (View v) {// some processing logic, and then specific jump}

Or

BtnClassSpace. setOnClickListener (new OnClickListener () {@ Override public void onClick (View v) {// specific jump
                     }                });
B) Specific jump
Intent intent = new Intent(DigitalschoolActivity.this,WebviewActivty.class);WebviewModel viewModel = new WebviewModel(title, uri);intent.putExtra("WebviewModel", viewModel);startActivity(intent);

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.