键盘上的Android清单未显示在设置中 [英] Android Manifest for Keyboard not Showing in Settings
问题描述
我正在制作我的第一个android应用程序,我需要它作为键盘服务.尽我所知,清单看起来不错,并且我有一个文件WifiJoy.java(在com.zwad3.wifijoy包中)以及所有其他文件.
I am making my first android app, and I need it to be a keyboard service. As best as I can tell, the manifest looks good, and I have a file, WifiJoy.java (in the com.zwad3.wifijoy package) as well as all other files.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zwad3.wifijoy"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<service android:name="com.zwad3.wifijoy.WifiJoy"
android:label="Wifi Joystick"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
</service>
<activity
android:name=".settings"
android:label="@string/title_activity_settings" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
这是WifiJoy.java的开始
Here is the beginning of WifiJoy.java
package com.zwad3.wifijoy;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.inputmethodservice.InputMethodService;
public class WifiJoy extends InputMethodService {
我知道这是不完整的,所以如果您需要更多信息,请告诉我,我只是不想让帖子超载.
I know this is incomplete so if you need more info let me know, I just didn't want to overload the post.
推荐答案
尝试在<service>
中添加一个<meta-data>
元素,例如SoftKeyboard SDK示例中此清单中所示的元素:
Try adding a <meta-data>
element in your <service>
, such as the one shown in this manifest from the SoftKeyboard SDK sample:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.softkeyboard">
<application android:label="@string/ime_name">
<service android:name="SoftKeyboard"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<meta-data android:name="android.view.im" android:resource="@xml/method" />
</service>
<activity android:name=".ImePreferences" android:label="@string/settings_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
</application>
</manifest>
这将指向res/xml/
中的XML文件(在上面的示例中名为method.xml
),其中包含有关IME的描述性信息,例如同一SDK示例中的该文件:
That would point to an XML file in res/xml/
(named method.xml
in the above sample), that contains descriptive information about your IME, like this file from the same SDK sample:
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.example.android.softkeyboard.ImePreferences"
>
<subtype
android:label="@string/label_subtype_generic"
android:icon="@drawable/icon_en_us"
android:imeSubtypeLocale="en_US"
android:imeSubtypeMode="keyboard" />
<subtype
android:label="@string/label_subtype_en_GB"
android:icon="@drawable/icon_en_gb"
android:imeSubtypeLocale="en_GB"
android:imeSubtypeMode="keyboard" />
</input-method>
这篇关于键盘上的Android清单未显示在设置中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!