Android ProgressDialog.show没有显示出来

时间:2016-04-26 02:24:50

标签: android android-event

我有以下代码。当我把它放在ACTION_DOWN中时它可以工作,当我把它放在ACTION_UP中时它没有,我做错了什么?

var item_name

1 个答案:

答案 0 :(得分:0)

尝试在ACTION_UP的情况下添加button1

也许ACTION_CANCEL的父级拦截了TouchEvent。孩子将获得ACTION_UP而不是 button1.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View view, MotionEvent event) { if (event.getAction() == android.view.MotionEvent.ACTION_DOWN) { //it works here // progress = ProgressDialog.show(ExampleAct.this,"Processing...","Preparing file", true); } else if (event.getAction() == android.view.MotionEvent.ACTION_UP ||event.getAction() == MotionEvent.ACTION_CANCEL ) { //It doesn't work here progress = ProgressDialog.show(ExampleAct.this,"Processing...","Preparing file", true); } return true; } });

using (WebClient wc = new WebClient())
{
    var json = wc.DownloadString("//api call here");
    jsonData = JsonConvert.DeserializeObject<List<T>>(json);
}