0

Android 2.2에서는 잘 작동하지만 Android 4.2에서는 작동하지 않는 회 전자가 있습니다.Android 4.2의 DropDown 목록이 작동하지 않습니다. Android 2.2에서 제대로 작동합니다.

가상 안드로이드로 디버깅을 시도했지만 Spinner를 클릭하면 디버그 창에서 아무 작업도 수행하지 않고 가상 안드로이드가 포커스를 잃습니다.

+0

"Spinner"구성 요소의 버전 2.2와 버전 4.2간에 비 호환성이 있습니까? – user2481894

+0

LogCat은 어떤 오류를보고합니까? – NetStarter

+1

LogCat가 0 개의 에러를보고했습니다. – user2481894

답변

1
Try This- 


    Spinner spinnerQuantity; 
     spinnerQuantity=(Spinner)findViewById(R.id.spinnerQuantity); 
     ArrayAdapter<?> adapterQuantity = new ArrayAdapter<Object>(this, android.R.layout.simple_spinner_item,qtyArray); 
       adapterQuantity.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 
       spinnerQuantity.setAdapter(adapterQuantity); 

     spinnerQuantity.setOnItemSelectedListener(new OnItemSelectedListener() { 

        @Override 
        public void onItemSelected(AdapterView<?> parent, View v, int position,long id) { 

         pos=position; 
         System.out.println("selected position:"+pos); 
         if(pos!=0){ 
          editItem.setVisibility(View.GONE); 
          spinnerQuantity.setVisibility(View.GONE); 
          textSelectQyt.setVisibility(View.GONE); 
         } 
         else{ 
          editItem.setVisibility(View.VISIBLE); 
          spinnerQuantity.setVisibility(View.VISIBLE); 
          textSelectQyt.setVisibility(View.VISIBLE); 
         } 
        } 

        @Override 
        public void onNothingSelected(AdapterView<?> arg0) { 
         // TODO Auto-generated method stub 
         //do nothing 
        } 
       }); 





    And in your xml- 




<Spinner 
      android:id="@+id/spinnerQuantity" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignLeft="@+id/text_quantity" 
      android:layout_below="@+id/text_quantity" 
      android:layout_marginTop="0dp" 
      android:prompt="@string/select_quantity" /> 

    It should work I have tested on all version..