Summary of Activity property Settings in Android development

  • 2020-06-15 10:12:46
  • OfStack

Activity is one of the four most basic and most commonly used components in Android. It is widely used in android development, so beginners need to be proficient in it. The following example is the common setting of Activity attribute.

android:allowTaskReparenting
Whether to allow activity to change subordinate tasks, such as switching from the SMS task to the browser task.

android:alwaysRetainTaskState
Whether to keep the state unchanged, such as switching back to home and opening it again, activity is in the final state

android:clearTaskOnLanunch
For example, P is activity, Q is activity triggered by P, then return Home, restart P, whether Q is displayed

android:configChanges
Whether to call the onConfigurationChanged() method such as "locale|navigation|orientation" when configuration list is modified.

android:enabled
Whether activity can be instantiated,

android:excludeFromRecents
Can be displayed in the recently opened activity list

android:exported
Is activity allowed to be called by another program

android:finishOnTaskLaunch
Whether to close the opened activity when the user restarts the task

android.icon

android:label

android:launchMode
"activity" "standard" "singleTop" "singleTask" "singleInstance"
The first two are group 1 and the last two are group 1


android:multiprocess
Allow multiple processes

android:name
The class name of activity must be specified

androidnHistory
Do you need to remove this activity when the user switches to another screen? This attribute was introduced in API level 3

android:permission

android:process
1 process name where the activity runtime resides, and all program components run in the default process of the application, which is the same as the package name of the application. The element process attribute can set a new default value for all components. But any component can override this default value, allowing you to run your program in multiple processes. If the assigned name begins with:, when the activity runs, a new process will be created that is exclusive to the program. If the process name starts with a lowercase letter, the activity will run in the global process, provided by its license.

android:screenOrientation
activity display mode, "unspecified" default value "landscape" landscape mode, width more than 1 "portrait" portrait mode, height more than width. "user" User Settings "behind" "sensor" "nosensor"

android:stateNotNeeded
Whether activity was destroyed and successfully restarted does not save the state

android:taskAffinity
activity's kinship, by default, is the same as activity for 1 application

android:theme
activity's theme, if not set, then activity's theme style is subordinate to the application, see the element's theme attribute

android:windowSoftInputMode
activity main window with soft keyboard interaction mode since API level 3 was introduced
How the active main window interacts with the soft keyboard window that contains the screen. The setting of this property affects two things:
1 > The state of the soft keyboard -- whether it is hidden or displayed -- when the activity (Activity) becomes the focus of the user's attention.
2 > Active main window resizing - Whether the active main window is reduced in size to make room for the soft keyboard or whether the current focus of the contents of the active window is visible when parts of it are overwritten by the soft keyboard.
It must be set to one of the values in the following list, or to one of the "state..." values. Add 1 "adjust..." A combination of values. Set multiple values for any group -- multiple "state..." values, for example &mdash has undefined results. The values are separated by |. Such as: < activity android:windowSoftInputMode="stateVisible|adjustResize" . . . >
The values set here (except for "stateUnspecified" and "adjustUnspecified") override the values set in the topic
Value description

The status of the "stateUnspecified" soft keyboard (whether it is hidden or visible) is not specified. The system will select an appropriate state or subject dependent setting. This is the default setting for software disk behavior.

The "stateUnchanged" soft keyboard is kept in whatever state it was in last time, visible or hidden, when the main window appears in front of it.

"stateHidden" when the user selects the Activity, the soft keyboard is hidden -- that is, when the user is sure to navigate to the Activity, instead of returning to it due to leaving another Activity.

The "stateAlwaysHidden" soft keyboard is always hidden when the Activity main window gets focus.

The "stateVisible" soft keyboard is visible when that is normal and appropriate (when the user navigated to the Activity main window).

"stateAlwaysVisible" The soft keyboard is visible when the user selects this Activity -- that is, when the user is sure to navigate to this Activity, rather than returning to it due to leaving another Activity.

"adjustUnspecified" it is not specified whether the Activity main window is resized to leave room for the soft keyboard, or whether the contents of the window are made visible by the current focus on the screen. The system will automatically select one of these modes depending on whether the contents of the window have any layout views that can scroll their contents. If there is such a view, the window will be resized, assuming that the contents of the scrolling window will be visible in a smaller area. This is the default behavior for the main window.

"adjustResize" the Activity main window is always resized to make room for the soft keyboard.

"adjustPan" This Activity main window does not resize the screen to make room for a soft keyboard. Instead, the contents of the current window move automatically so that the current focus is never overridden by the keyboard and the user always sees the part of the input. This is generally not expected to be resized, as the user may turn off the soft keyboard in order to interact with the overridden content.

This is the end of this article, I hope you enjoy it.


Related articles: