How to add preference of Custom Input method to Android Settings app?

笑着哭i 提交于 2020-01-09 11:24:10

问题


Recently I've started to develop Android Soft Keyboard and got some problem with preferences.

How to add a preferences to Android setting app? I've searched almost all the source code of AnySoftKeyboard, but haven't found anything what would add them to Settings app.

I'm placing a link to show what I meant: http://code.google.com/p/softkeyboard/wiki/Settings

(first picture from begin)

Thank you

P.S. Sorry for my bad english..


回答1:


I've found it myself:

in XML of input method you need to put android:settingsActivity tag with link to your PreferenceActivity class: Example




回答2:


Here is an example: set android:settingsActivity in your input-method xml declaration.

<?xml version="1.0" encoding="utf-8"?>
<input-method
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:settingsActivity="com.justes.yogabook.holo_keyboard.wrapper.SettingsActivity">
    <subtype
        android:label="@string/yogabook_holo_keyboard_subtype_label"
        android:imeSubtypeLocale="en_US"
        android:imeSubtypeMode="keyboard" />
</input-method>


来源:https://stackoverflow.com/questions/3524110/how-to-add-preference-of-custom-input-method-to-android-settings-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!