Selecting iPhone & Android and pushing DISPLAY ⇒ |
Checkbox
in your layout.
Because a set of checkbox options allows the user to select multiple items, each checkbox is managed separately and you must register a click listener for each one.
CheckBox
object receives an on-click event.
To define the click event handler for a checkbox, add the android:onClick
attribute to the CheckBox
element in your XML layout.
The value for this attribute must be the name of the method you want to call in response to a click event.
The activity hosting the layout must then implement the corresponding method.
However, this example uses another approach.
|
|
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android = "http://schemas.android.com/apk/res/android" package = "com.example.wenchen.myapplication"> <application android:icon = "@mipmap/ic_launcher" android:label = "Checkboxes" android:theme = "@style/AppTheme"> <activity android:name = ".MainActivity" android:label = "@string/app_name"> <intent-filter> <action android:name = "android.intent.action.MAIN" /> <category android:name = "android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> |
Legally you can argue that it’s all according to Hoyle (according to plan or the rules). |