android - Making a checklist in Google Glass App -
I am developing an application for Google Glass. Part of the application is to make a check list in it.
In this part I have a regular text, icon and a title card.
My main question is now: Is it possible to add checkboxes to these cards? If so: How can I add it?
Because it's running Android, you can always add it to the checkbox that you can use on a normal Android application To add an item handler, click Add to Android: OnClick attribute for the element in your XML layout, for example:
Click here for a checkbox to define event handlers. The value for this attribute should be the name of the method that you want to call in response to a click event. The same method should be applied if hosting the activity layout
For example, there are items in a couple of checkboxes list here:.?
& lt; XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; LinearLayout xmlns: android = "Http://schemaskandroidkcom/apk/res/android" android: orientation = "vertical" android: Layout_width = "Fill_parent" Android: layout_height = "fill_parent" & gt; & Lt; Android: layout_height = "wrap_content" android: text = "@ string / meat" android: onClick = "onCheckboxClicked" /> & Lt; Android: layout_height = "wrap_content" android: text = "@ string / cheese" android: onClick = "onCheckboxClicked" /> & Lt; / LinearLayout & gt;
Within the activity that hosts this layout, the following method clicks the check box for both check boxes:
public zero onCheckboxClicked ( See See) {// Is the scene now checked? Boolean Check = (see (checkbox). the inspection (); // Check which checkbox clicked on the switch (see .gateID)} {case R.D. checkbox_mat: if (checked) // put some meat on sandwich // Remove the meat brake; Case R.id.checkbox_cheese: If (checked) // cheese is breaking me and I am lactose intolerant; // TODO: veggie sandwich}}
The method you announce in Android: The onClick attribute should have exactly one signature as above. Specifically, the method should: Checkbox yourself (such as when you want to change state as it is loading):
Public return zero Define a view as its only parameter Tip (This view will be clicked) Use a saved checkbox projection), setChecked (boolean) or toggle () method.
I think you should ask a different question. The problem is not just adding them, but how will you check them?
If you have only one, you can make a gesture detector and toggle onTap checking. But if you have multiple checkboxes, then you will need to think about who is a tooling.
Comments
Post a Comment