1
鳥瞰圖不工作
我試圖使用三星Galaxy S4的新功能鳥瞰圖,特別是onHover選項事件。我已經擁有它的...銀河S4:onHover選項/鳥瞰圖的輸入法並不INPUTMETHOD工作
- 目標API級別17
- 工作正常的應用程序提供onHover選項事件偵聽器
- 設置意圖過濾器com.sec.android.airview.HOVER
現在我想用它作爲輸入法。我的問題是輸入法的觀點沒有得到任何onHover選項的事件,即使我還設置了鳥瞰圖的意圖過濾器:
AndroidManifest.xml中的摘錄:
<application android:label="@string/ime_name"
<service android:name="com.example.keyboard"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<intent-filter>
<action android:name="com.sec.android.airview.HOVER" />
</intent-filter>
<meta-data android:name="android.view.im" android:resource="@xml/method" />
</service>
</application>
目前我有一個簡單的LinearLayout一個按鈕在我的輸入方法的佈局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hover Button"
android:id="@+id/hoverbutton2"/>
</LinearLayout>
的事件監聽器被設置這樣的:
Button hoverButton = (Button) mInputView.findViewById(R.id.hoverbutton2);
hoverButton.setOnHoverListener(new View.OnHoverListener() {
@Override
public boolean onHover(View v, MotionEvent event) {
Log.d(TAG, "hoverButton2: onHover");
return false;
}
});
以相同方式設置的onClick偵聽器按預期工作。
任何指針?
這正是我會爲** **應用程序做的,但我想從**輸入法**中獲取懸停事件。除此之外,您在AndroidManifest.xml中設置了兩次intent過濾器。我相信申請中的申請是不必要的。 – Frederic