Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Spinner Customize 5
package com.example.spinnersample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Spinner spinner = findViewById(R.id.spinner);
ArrayAdapter<String> adapter = new ArrayAdapter<>(
this,
R.layout.custom_spinner,
getResources().getStringArray(R.array.list)
);
adapter.setDropDownViewResource(R.layout.custom_spinner_dropdown);
spinner.setAdapter(adapter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.