theIB.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(hasFocus==true)
{
theTV.setText(R.string.onfocus);
theIB.setImageResource(R.drawable.onfocus);
}else if(hasFocus==false)
{
theTV.setText(R.string.lostfocus);
theIB.setImageResource(R.drawable.offfocus);
}
}
});
然后我怎么点那个按钮也没变化啊。点击ImageButton不能改变焦点吗?
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(hasFocus==true)
{
theTV.setText(R.string.onfocus);
theIB.setImageResource(R.drawable.onfocus);
}else if(hasFocus==false)
{
theTV.setText(R.string.lostfocus);
theIB.setImageResource(R.drawable.offfocus);
}
}
});
然后我怎么点那个按钮也没变化啊。点击ImageButton不能改变焦点吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货