

Public override string this => planetNames Public MyAdapter(MainActivity mainActivity, List planetNames) Public void OnNothingSelected(AdapterView parent) ((TextView)view.FindViewById(Resource.Id.MytextView)).SetTextColor() //Change selected text color Public void OnItemSelected(AdapterView parent, View view, int position, long id) Internal class myItemSelectedListener :, AdapterView.IOnItemSelectedListener (requestCode, permissions, grantResults) īase.OnRequestPermissionsResult(requestCode, permissions, grantResults)

Public override void OnRequestPermissionsResult(int requestCode, string permissions, .Permission grantResults) Private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) Spinner.OnItemSelectedListener = new myItemSelectedListener() Var adapter = new MyAdapter(this, planetNames) Spinner.ItemSelected += new EventHandler(spinner_ItemSelected) Spinner.SetPopupBackgroundDrawable(Resources.GetDrawable(_blue_grey_800)) Spinner spinner = FindViewById(Resource.Id.spinner) Set our view from the "main" layout resource

Protected override void OnCreate(Bundle savedInstanceState) Public class MainActivity : AppCompatActivity Text color of the dropdown portion of the spinner: you need to create an custom adapter to achieve it. Step 3 − Add the following code to src/MainActivity.java import 7.app.You can change the background color and text color of the dropdown portion of the spinner.Ĭhange the background color: you can use spinner.SetPopupBackgroundDrawable(Resources.GetDrawable(_blue_grey_800)) Step 2 − Add the following code to res/layout/activity_main.xml. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.

This example demonstrates how do I make an android spinner with initial default text in android.
