トピック「アクセシビリティサービス」の新機能です。ボタンをクリックするとスクロールでき、電話やその他多くのものをオフにできます。 私のレイアウト(action_bar.xml)は、可動 ので、 は誰がどのようにしてください。ここ可動「アクセシビリティサービス」でActionBar Movableを作成する方法
action_barようにすることです私に言うことができ、私の
action_bar.xml ::
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/power"
android:layout_weight="1"
android:text="@string/power"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/volume_up"
android:text="@string/volume"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:layout_weight="1"
android:id="@+id/scroll"
android:text="@string/scroll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/swipe"
android:text="@string/swipe"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
と私はそれを使用しているActionBarService.Java、:
Activity
またはFragment
にいつもView
と同じ規則によって
@Override
protected void onServiceConnected() {
// Create an overlay and display the action bar
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
mLayout = new FrameLayout(this);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.type = WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
lp.format = PixelFormat.TRANSLUCENT;
lp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.TOP;
LayoutInflater inflater = LayoutInflater.from(this);
inflater.inflate(R.layout.action_bar, mLayout);
wm.addView(mLayout, lp);
}
ありがとうございました。 でもまだ問題が起きています。つまり、オーバーレイをフルスクリーンにすると、別のウィンドウがタッチイベントを受信しません。 これをチェックしてこの問題を解決してください –
この回答は非常に良いですが、基本的な問題は無視しています。アクセシビリティサービス内でこれが行われていることは特別な考慮が必要です。 – ChrisCM
@SanjuBaghla:申し訳ありませんが、私はこの瞬間を見逃しました。 @ChrisCMは正しいです、これを実現するのは難しいでしょう。 'Accessibility Serivice'トピック以外のオーバーレイがあるので、別の質問を投稿するか、存在する解決策を探すべきだと思います。 – fishbone