如题:
我想切换两个控件之间的焦点,事实上,机顶盒用android自带的控件 例如listview或者gridview 是比较不明智的,因为需要适配手机等,所以控件某些方面(如每个控件的焦点,切换时的速度,位置等)是不会很匹配机顶盒的.最好的方法是自己绘制一个gridview,然后中间有两个view这样
但是任务比较繁重,所以只能简单的自定义了下两个控件,然后在gridview里面添加了一条属性:
自定义的imageview:
public class iamgeview extends ImageView {
public iamgeview(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public iamgeview(Context context, AttributeSet attrs) {
super(context, attrs);
}
public iamgeview(Context context) {
super(context);
}
@Override
protected void onFocusChanged(boolean gainFocus, int direction, Re