Android Siege Lion Checkbox&radiogroup&autocompletetextview&multiautocompletetextview&togglebutton

Source: Internet
Author: User

Add constructor to subclass source----Generate Constractor from superclass

the realization of the Marquee effect (Textview cycle):

1. Define the 4 properties of the TextView tag: android:singleline= "true"//make it only one line android:ellipsize= "marquee"//Remove ellipsis android:focusable = "true "//Get focus Android:focusableintouchmode =" true "2, if there are more than one of the lights at the same time, if the above method can only achieve the first, because he grabbed the focus, so that the latter can not be achieved. So we need to customize the class MarqueeText inherit TextView, and import the implementation of three constructors; the replication isfocued method, which returns True (the default has focus, usually only one has focus on the first line) @Override public    Boolean isFocused () {        return true;    } 3, use a custom class by using the package name and custom class name instead of TextView (package name + class name under SRC)


Autocompletetextview
1. Function:  dynamically match the input content, such as Baidu search engine input text can be displayed according to the content of the popular information matching 2. Unique properties:  android:completionthreshold= "2"---> Set auto match when entering how many characters

First step: Initialize the control
Step Two: Arrayadapter adapter
Step three: Initialize the data source---to match the contents of the text box input
Fourth step: Current control bindings Adapter


Multiautocompletetextview CONTROLS:
1. Function:  can support the selection of multiple values (in the case of multiple input), separated by a delimiter, and when each value is selected to re-enter the value will automatically go to match, can be used to send text messages, e-mail to select the type of contact. 2. Unique properties:  android:completionthreshold= "2" and set the number of characters entered automatically match 3. Set the delimiter  Mtxt.settokenizer (new Multiautocompletetextview.commatokenizer ());
First step: Initialize the control
Step Two: Arrayadapter adapter
Step three: Initialize the data source---to match the contents of the text box input
Fourth step: Current control bindings Adapter
Fifth step: Set the delimiter Mtxt.settokenizer (New Multiautocompletetextview.commatokenizer ());
ToggleButton Controls : 1. What's the matter ToggleButton:  ToggleButton has two states: checked and unchecked, and you need to set different display text 2.ToggleButton properties for different states:  android:checked= "true"  android:textoff= "off"  andriod:texton= "Off"
1. Main method implementation Oncheckedchangelistener Interface 2. Initialize the control TOGGLEBUTTON/IMAGEVIEW3. Set listener 4 for ToggleButton object. Override Oncheckedchange ():  when the TB is clicked, the current method is executed with the parameter Buttonview---represents the ischecked of the control being clicked  ---Represents the effect of the clicked control's state  : When you click on this control, Replace the IMG background with the status.  Code: Img.setimageresource (isChecked?) R.drawable.on:r.drawable.off);
CheckBox control : check box 1, there are two states   checked (true), unchecked state (False) 2, properties:   android:id= "@+id/checkbox"   android: Layout_width= "Wrap_content"   android:layout_height= "wrap_content"   android:checked= "false"   Android: text= "Male"
CheckBox Property: Checked (default value false), text (option content) Step:
1, initialization;
2. Set Listener Setoncheckedchangelistener (inner Class)
3, through the internal class method Oncheckedchange () to determine whether the checkbox is selected;
4, using the function GetText () to obtain the text content of the checkbox, in order to facilitate printing, using the ToString () method to convert to a string;
5. Print logs in console: log.i ("tag", text);//LOG.I ("tag", ischecked+ "");


Radiogroup and RadioButton Controls: (radio)1, Radiogroup:   A collection of RadioButton, providing multiple selection one mechanism 2, properties:   android:orientation= {   "vertical-----> Vertical Arrangement"   "horizontal----> Horizontal arrangement"} RadioButton cannot be canceled after a single click, but it is a single box =. =!

















Android Siege Lion Checkbox&radiogroup&autocompletetextview&multiautocompletetextview&togglebutton

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.