Android Studio Study Notes 2021-4-14

  1. Regarding the issue of horizontal and vertical screens, the interface has been changed to landscape in the design interface, but the virtual machine is still displayed vertically! Draw a schematic diagram as follows. It should be easy to understand insert image description here
    that the solution is to draw out the component frame on the top of the virtual machine, then light up the "auto-rotate" button, rotate the screen in the tool box on the right, and the interface will follow the screen. And spin it! !

  2. To change the color of the button, it is necessary to write backgroundTint, background does not work!

android:backgroundTint="@color/blue"
  1. A little experience about constraint layout: if there are controls in the interface that are vertically and horizontally centered relative to the entire screen, or are leftmost and rightmost at the top and bottom, then other controls are best to be constrained relative to these controls, not relative to the entire frame to add constraints, otherwise there will always be some weird dislocations when you get it into a real machine or a virtual machine.
    When adding constraints to a control, you have to figure out who do you want it to align with? For example: insert image description here
    In the picture, pay attention to the part framed by me. In fact, we want the left end of the "Return" button to be aligned with the left end of the input box above, and the button to be directly aligned horizontally, and the right end of the "OK" button to be aligned with the input box The right end is aligned, so this way of adding constraints can well realize our ideas. No matter whether the screen becomes larger or smaller, the relative positions of these controls will not change. And, if you want to move multiple controls at the same time, these mutually constrained controls can be moved together instead of being moved one by one!
    If you constrain these buttons relative to the entire screen, once the screen becomes larger or smaller, the positions of these buttons will be changed!

Today, I have been working on various interfaces and direct interface jumps. I will put aside the parts about connecting the database and core algorithms for a while, waiting for the next step of the instructor's arrangement.

Guess you like

Origin blog.csdn.net/qq_41544842/article/details/115699666