我提交的亚马逊消防电视申请失败的原因如下:
问题1:选择时不会突出显示屏幕的交互部分:可以导航和选择进度条上方的倒带,快进和播放按钮,但不会显示突出显示的光标。
我正在使用android提供的默认媒体控制器类,它不提供此功能。 我能够捕获控件,但我无法在按键上添加突出显示并在按键上删除它。有人能帮忙吗?
答案 0 :(得分: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();