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);