Android text and input --- spell checker

Source: Internet
Author: User

In addition to code, you also need to provide the configuration file and metadata file for the spelling checker. The inventory file defines the application, service, and Activity used to control settings, such as: <manifest xmlns: android = "http://schemas.android.com/apk/res/android" package = "com. example. android. samplespellcheckerservice "> <application android: label =" @ string/app_name "> <service android: label =" @ string/app_name "android: name = ". sampleSpellCheckerService "android: permission =" android. permission. BIND_TEXT_SERVICE "> <intent-filter> <action android: name =" android. Service. textservice. spellCheckerService "/> </intent-filter> <meta-data android: name =" android. view. textservice. scs "android: resource =" @ xml/spellchecker "/> </service> <activity android: label =" @ string/sample_settings "android: name = "SpellCheckerSettingsActivity"> <intent-filter> <action android: name = "android. intent. action. MAIN "/> </intent-filter> </activity> </application> </manifest> note: BIND_TEXT_SERVICE permission must be applied to ensure that only the system is bound to this service. The spellchecker is also specified in the service definition. xml Metadata File, the content of this file is as follows: <spell-checker xmlns: android = "http://schemas.android.com/apk/res/android" android: label = "@ string/spellchecker_name" android: settingsActivity = "com. example. spellCheckerSettingsActivity "> <subtype android: label =" @ string/subtype_generic "android: subtypeLocale =" en "/> <subtype android: label =" @ string/subtype_generic "android: subtypeLocale = "fr"/> </spell-checker> This metadata specifies the spelling checker used to control the set Activity. It also defines the subtype for the spell checker. In this example, the subtype defines the language environment that the spell checker can process. The application that uses TextView to access the spell checker service from the client will automatically receive the spell check because TextView will automatically use the spell checker, as shown in figure 2. in TextView, however, in some cases, you may want to directly interact with the spelling checker service, showing the control flow for interaction with the spelling checker service: Figure 3. interact with the spelling checker Service

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.