8.2.2015
페이지 정보
작성자 Ryangkyung 작성일15-08-03 00:20 조회3,612회 댓글0건본문
EditText android:id="@+id/edit_message"
This provides a unique identifier for the view, which you can use to reference the object from your app code, such as to read and manipulate the object (you'll see this in the next lesson).
The at sign (@) is required when you're referring to any resource object from XML. It is followed by the resource type (id in this case), a slash, then the resource name (edit_message).
The plus sign (+) before the resource type is needed only when you're defining a resource ID for the first time. When you compile the app, the SDK tools use the ID name to create a new resource ID in your project's gen/R.java file that refers to the EditText element. With the resource ID declared once this way, other references to the ID do not need the plus sign. Using the plus sign is necessary only when specifying a new resource ID and not needed for concrete resources such as strings or layouts. See the sidebox for more information about resource objects.
Resource Objects
A resource object is a unique integer name that's associated with an app resource, such as a bitmap, layout file, or string.
Every resource has a corresponding resource object defined in your project's gen/R.java file. You can use the object names in the R class to refer to your resources, such as when you need to specify a string value for the android:hint attribute. You can also create arbitrary resource IDs that you associate with a view using the android:id attribute, which allows you to reference that view from other code.
The SDK tools generate the R.java file each time you compile your app. You should never modify this file by hand.
(source: http://developer.android.com/intl/zh-CN/training/basics/firstapp/building-ui.html#Button)
An Intent is an object that provides runtime binding between separate components (such as two activities). The Intent represents an app’s "intent to do something." You can use intents for a wide variety of tasks, but most often they’re used to start another activity.
(source: http://developer.android.com/intl/zh-CN/training/basics/firstapp/starting-activity.html)
Alt + Enter (option + return on Mac) to import missing classes.
public Intent putExtra (String name, int value)
Add extended data to the intent. The name must include a package prefix, for example the app com.android.contacts would use names like "com.android.contacts.ShowAll".
(source: http://developer.android.com/intl/zh-CN/reference/android/content/Intent.html#putExtra(java.lang.String, android.os.Bundle))
menuInflater: This class is used to instantiate menu XML files into Menu objects.
댓글목록
등록된 댓글이 없습니다.