Android's four major components and five layouts

       The four major components of Android: Activity, Service (service), Content Provider (content provider), Broadcast Reciver (broadcast receiver)

       Activity

       It is the window that the Android program exchanges with the user. From the perspective of visual effects, an Activity occupies the current window, responds to all window events, and has interface elements such as controls and menus. From the perspective of internal logic, Activity needs to do a lot of persistent things in order to maintain the state of each interface, and also properly manage the life cycle and some jump logic.

       Service

       It is the Activity with the interface stripped off. They are relatively close in many Android concepts, and they are all modules that encapsulate a complete functional logic, usually running in the background for a long time, accepting upper-level instructions, and completing related transactions. Define the Intent that needs to be accepted, provide synchronous or asynchronous interfaces, and communicate through these interfaces after the upper layer binds it.

        Content Provider

        Provides access schemes for third-party application data. The ContentProvider class can be derived to perform selection sorting like a database. It shields the storage details of internal data and provides a unified interface model to the outside world, which greatly simplifies upper-layer applications and provides a more convenient way to integrate data.

       Broadcast Receiver

       Receive one or more Intent jumps as trigger events, accept related messages, do some simple processing, convert them into a notification, and unify the event broadcasting mode of Android.

 

       Android's five major layouts: FrameLayout (frame layout), LinearLayout (linear layout), AbsoluteLayout (absolute layout), RelativeLayout() relative layout, TableLayout (table layout)

       FrameLayout

       Everything is placed in the upper left corner in turn and will overlap. This layout is relatively simple, and only a few simpler things can be placed.

       Linearlayout

       Each LinearLayout is divided into vertical layout (android:orientation="vertical") and horizontal layout (android:orientation="horizontal"). In the vertical layout, there is only one element in each row, and multiple elements are arranged vertically downward in sequence; in the horizontal layout, there is only one row, and each element is arranged in turn to the right.

       AbsoluteLayout

       The absolute layout uses X, Y coordinates to specify the position of the element. This layout method is relatively simple, but when the screen is rotated, problems often occur, and when there are multiple elements, the calculation is more troublesome.

       RelativeLayout

       Relative layout can be understood as a layout method in which an element is used as a reference to locate. The main attributes are: relative to a certain element android:layout_below, android:layout_toLeftOf relative to the parent element android:layout_alignParentLeft, android:layout_alignParentRigh

      TableLayout

       Each TableLayout has a table TableRow, and each element can be specifically defined in the TableRow.

       Each interface has its own appropriate method. These five layouts can be nested and used to make a beautiful interface.

            

           

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327057361&siteId=291194637