1

Google TV 用のアプリケーションを作成しています。ブロードキャストの上にカスタム トースト オーバーレイを作成しようとしています。

次のようにカスタムトーストを作成しました。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_toast_layout_id"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFF"
android:orientation="horizontal"
android:padding="5dp" >

<TextView
    android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:textColor="#000" />

</LinearLayout>

そして、それを googleTV アプリのビューに実装しました:

     LayoutInflater inflater = getLayoutInflater();

            View layout = inflater.inflate(R.layout.main,
            (ViewGroup) findViewById(R.id.custom_toast_layout_id));

            // Toast...
            Toast toast = new Toast(getApplicationContext());
            toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
            toast.setDuration(Toast.LENGTH_LONG);
            toast.setView(layout);
            toast.show();

私の質問は、視聴中にこのオーバーレイをトリガーできるように、このアプリに通常のブロードキャスト情報をアプリに表示させるにはどうすればよいですか?

どんな助けでも大歓迎です。

4

1 に答える 1