0

我提交的亚马逊消防电视申请失败,原因如下:

问题 1:屏幕的交互部分在选择时未突出显示:可以导航和选择进度条上方的后退、快进和播放按钮,但看不到突出显示的光标。

我正在使用 android 提供的默认媒体控制器类,它不提供此功能。我能够抓住控件,但我无法在按下键时添加高亮并在按下键时将其删除。有人能帮忙吗?

4

1 回答 1

0

试试这个可能有效..

           Field ffwd = MediaController.class.getDeclaredField("mFfwdButton");
                Field rwd = MediaController.class.getDeclaredField("mRewButton");
                Field playPause = MediaController.class.getDeclaredField("mPauseButton");
                //System.out.println(f.get(d));//not accessible now
                ffwd.setAccessible(true);//Abracadabra
                rwd.setAccessible(true);//Abracadabra 
                playPause.setAccessible(true);
                //System.out.println("Fusioni"+ffwd.get(mediaController)+" "+f1.get(mediaController));//now its ok
                ffwdBtn = (ImageButton) ffwd.get(mediaController);
                rwdBtn = (ImageButton) rwd.get(mediaController);
                playPauseBtn = (ImageButton) playPause.get(mediaController);
                //Log.i("imbtn",""+imbtn);
                ffwdBtn.setOnFocusChangeListener(new OnFocusChangeListener() {
                    @Override
                    public void onFocusChange(View v, boolean hasFocus) {
                        if(hasFocus)
                            v.setBackgroundResource(R.drawable.round_background_selected);
                        else
                            v.setBackgroundColor(Color.TRANSPARENT);
                    }
                });
                rwdBtn.setOnFocusChangeListener(new OnFocusChangeListener() {
                    @Override
                    public void onFocusChange(View v, boolean hasFocus) {
                        if(hasFocus)
                            v.setBackgroundResource(R.drawable.round_background_selected);
                        else
                            v.setBackgroundColor(Color.TRANSPARENT);
                    }
                });
                playPauseBtn.setOnFocusChangeListener(new OnFocusChangeListener() {
                    @Override
                    public void onFocusChange(View v, boolean hasFocus) {
                        if(hasFocus)
                            v.setBackgroundResource(R.drawable.round_background_selected);
                        else
                            v.setBackgroundColor(Color.TRANSPARENT);
                    }
                });
                playPauseBtn.setBackgroundResource(R.drawable.round_background_selected);
                rwdBtn.setBackgroundColor(Color.TRANSPARENT);
                ffwdBtn.setBackgroundColor(Color.TRANSPARENT);
                playPauseBtn.setFocusable(true);
                playPauseBtn.requestFocus();
于 2014-11-05T09:45:21.817 回答