当前位置: 代码迷 >> Android >> 好郁闷的有关问题
  详细解决方案

好郁闷的有关问题

热度:69   发布时间:2016-04-28 04:50:58.0
好郁闷的问题
下面这段代码中有一个input_condtion.requestFocus();,我发现程序是执行到这里来的,但是焦点并没有返回input_condtion(edt控件)这个控件,大家谁知道原因吗?
class MyHandler extends Handler{
@Override
public void handleMessage(Message msg)
{
if(loadingDialog != null)
{
loadingDialog.dismiss();
}
if(msg.what == 1)
{

if(mops != null && !mops.isEmpty())
{
totalCount = mops.size();
int j = -1;
for (Mops mops1 : mops) 
{
j++;
if(mops1.isChange())
{
break;
}
}
if(j >= 0)
{
initData(mops.get(j));
}
adapter.notifyDataSetChanged();
}
common_total.setText(String.format(getResources().getString(R.string.common_total), totalCount+""));
if(null != popupDropDownList)
{
popupDropDownList.dismiss();
}
Toast.makeText(mContext, "1232!", Toast.LENGTH_LONG).show();

input_condtion.setFocusable(true);
input_condtion.setFocusableInTouchMode(true);
input_condtion.requestFocus();
    
// input_condtion.requestFocus();
// input_condtion.requestFocus();
//input_condtion.setFocusable(true);


else if(msg.what == 2)
{
if((Boolean)msg.obj)
{
mops.clear();
adapter.notifyDataSetChanged();
initData(null);
Toast.makeText(mContext, "盘点成功!", Toast.LENGTH_LONG).show();

else 
{
Toast.makeText(mContext, "盘点失败,请检查数据!", Toast.LENGTH_LONG).show();
}
}
}
}
这个是效果图,焦点没返回输入框去
------解决方案--------------------
我弄错了 应该是 request 。    set 只是设置状态。

input_condtion.post(new Runnable() {
            @Override
            public void run() {
                input_condtion.requestFocus();
            }
        });
  相关解决方案