Creating activities where it should be noted

  • A reference in XML id, to use @ id / id_name. And if it is necessary to define a id, you need to use @ + id / id_name this syntax.
  • match_parent represents the current element and let the parent element as high or wide, and wrap_content represents the current element has only just able to contain the contents inside.
  • When you call setContentView () method to load a layout for the current activity, usually pass in a layout file id.
  • Activities of the registration statement to be placed in <application> tag within, Android Studio automatically registered.
  • Configuration Main Activity: adding <activity> tag <intent-filter> tags, and added in the tag <category android: name = "android.intent.category.DEFAULT" /> and <category android: name = "com. example.activitytest.MY_CATEGORY "/> two statements can be. The main role of the primary activity is to click on the desktop when the application is first opened this event.
  • In the event, the element can be obtained in the layout file defined by the findViewById () method. The created object is instantiated.
  • By calling setOnClickListener () method for the button to register a listener.
  • MakeText static method () method requires passing three parameters: Context, i.e. Toast (alert message) requested context, text, display duration
  • <Item> tag is used to create a specific menu item
Published 25 original articles · won praise 18 · views 2127

Guess you like

Origin blog.csdn.net/weixin_43568110/article/details/94768961