Spinner does not show selected value

后端 未结 25 1347
-上瘾入骨i
-上瘾入骨i 2020-12-03 13:16

I have implemented the spinner by populating the array list through database.I can get and show the array list in my spinner array adapter but if I select the item in spinne

25条回答
  •  离开以前
    2020-12-03 13:52

    The issue from what I found was with the style sheet.Use this

     
    

    For the xml layout use this

    
    
    
        
    
            
    
            
        
    
    

    And finally for the class

    String [] NUMBERS= {"3 ","6 ","13 "};
    
    Spinner s_spinner = (Spinner) findViewById(R.id.Spinner);
    
    ArrayAdapter spinnerAdapter = new ArrayAdapter<>(this,
                        android.R.layout.simple_dropdown_item_1line, NUMBERS);
    
    // Specify the layout to use when the list of choices appears 
               spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    
    // attaching data adapter to spinner
    s_spinner.setAdapter(spinnerAdapter );
    

提交回复
热议问题