2012-08-04 2 views
1

갤러리의 위치에 따라 하나 또는 다른 편집 텍스트가 포커스를받습니다. 비록 내가 할 수는 있지만, 행동의 갤러리 크래시 : 갤러리가 위치를 잡고 편집 텍스트에 집중할 때 갤러리의 속도가 충돌합니다. 갤러리가 너무 늦어서 제 시간에 요청을받지 못한 것처럼 보입니다.requestFocus를 호출 할 때 동작 갤러리가 중단됩니다.

중요한 정보가 없습니다.

galleryView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { 
    public void onItemSelected(
      @SuppressWarnings("rawtypes") AdapterView adapterView, 
      View view, int pos, long l) { 

     if (pos == 0) { 
      pie_foto_1.post(new Runnable() { 
       public void run() { 
        pie_foto_1.requestFocus(); 
       } 
      }); 
     } 

     if (pos == 1) { 
      pie_foto_2.post(new Runnable() { 
       public void run() { 
        pie_foto_2.requestFocus(); 
       } 
      }); 
     } 

     if (pos == 2) { 

      pie_foto_3.post(new Runnable() { 
       public void run() { 
        pie_foto_3.requestFocus(); 
       } 
      }); 

      pie_foto_1.setVisibility(View.INVISIBLE); 
      pie_foto_2.setVisibility(View.INVISIBLE); 
      pie_foto_3.setVisibility(View.VISIBLE); 

     } 
    } 

    public void onNothingSelected(
      @SuppressWarnings("rawtypes") AdapterView adapterView 
    ) { 
    } 
}); 

답변

0

갤러리는 새로운 위치를 얻는 데 더 많은 시간이 필요합니다. 그래서 멋진 전환을 얻으려면 갤러리가 위치를 바꿀 때까지 지체합니다.

       else if (pos == 1) 
           { 
            Runnable mMyRunnable = new Runnable() { 
             public void run() { 
              pie_foto_1.post(new Runnable() { 
               public void run() { 
                pie_foto_2.requestFocus(); 
                // headline.clearFocus(); 

               } 
              }); 
             } 
            }; 

            Handler myHandler = new Handler(); 
            myHandler.postDelayed(mMyRunnable, 100); 
           }  
관련 문제