14
CHAPTER 3: Activities
Declaring Activities
To declare an activity, you can write the following inside AndroidManifest.xml, for example:
package="com.example.myapp">
...
...
As shown in this particular example, you can start the name with a dot, which leads
to prepending the app’s package name. In this case, the full name of the activity is
com.example.myapp.ExampleActivity. Or you can write the full name, as shown here:
"com.example.myapp.ExampleActivity" />
...
...
All attributes you can add to the element are listed in the section “Activity
Related Manifest Entries” in the online text companion.
The following are elements that can be child elements inside the activity element:
This is an intent filter. For details, see the online text companion at “Activity-
Related Manifest Entries”. You can specify zero, one, or many intent filters.
Starting with Android 7.0, you can specify layout attributes in multiwindow
modes as follows, where you of course can use your own numbers:
android:defaultWidth="600dp"
android:gravity="top|end"
android:minHeight="450dp"
android:minWidth="300dp" />
The attributes defaultWidth and defaultHeight specify the default dimensions, the attribute
gravity specifies the initial placement of the activity in freeform modes, and the attributes
minHeight and maxHeight signify minimum dimensions.
Do'stlaringiz bilan baham: |