Untitled - MARKUP 0.79 KB
                    
             public class MainActivity extends AppCompatActivity {
    private Spinner spinner1;
//    nie wymusza niemutowalnosci
    private ArrayAdapter<CharSequence> adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        spinner1=findViewById(R.id.spinner1);
        adapter=ArrayAdapter.createFromResource(this, R.array.elementy, androidx.appcompat.R.layout.support_simple_spinner_dropdown_item);
        spinner1.setAdapter(adapter);
    }


    <string-array name="elementy">
        <item>Czerwony</item>
        <item>Zielony</item>
        <item>Niebieski</item>

    </string-array>
            
            

Paste Hosted With By Wklejamy.pl