


Use getDropDownView() for opened Spinner.

I have done this as following.I have use getDropDownView() and getView() methods. So app developer can easily set spinner text gravity using gravity attribute inside textview layout xml. View view = super.getDropDownView(position, convertView, parent) ĪtDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) Spinner text alignment setting is some times required into android applications because if we have a larger size spinner with minimum size of 200dp width and items are single word then there are pretty much space remaining on both sizes.
Spinner spinner = (Spinner) this.findViewById(R.id.spinner1) ĪrrayAdapter dataAdapter = new ArrayAdapter (this,android.R.layout.simple_spinner_item, list) įor (int i = 0 i < cursor.getCount() i++) ->in this line very important so add View getDropDownView(int position, View convertView, In my Android application, I am using spinner, and I have loaded data from the SQLite database into the spinner, and it's working properly. ArrayAdapter