Xamarin Android工具栏微调器

时间:2016-12-21 19:42:16

标签: android xamarin android-spinner android-toolbar

我的工具栏微调器未显示文字。适配器已填满,但只显示箭头。

var myList = Task.Run(() => new MyListService().Get(Convert.ToInt32(new LoginApplication().UserName), token)).Result.OrderBy(x => x.Vencimento).ToArray();

[编辑] MyList在调试时包含元素

var adapter = new MyAdapter(this, Resource.Layout.simple_icon_spinner_dropdown_item, carteirinhas);

toolbarSpinner.Adapter = adapter;

- 编辑 - 添加了MyAdapter CustomAdapter类

public class MyAdapter : ArrayAdapter<MyModel>{
        private Context _context;
        private MyModel[] _values;

        public MyAdapter(Context context, int textViewResourceId, MyMdoel[] values) : base(context, textViewResourceId)
        {
            _context = context;
            _values = values;
        }

        public int Count()
        {
            return _values.Length;
        }

        public MyModel GetItem(int position)
        {
            return _values[position];
        }

        public long GetItemId(int position)
        {
            return position;
        }

        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            TextView label = new TextView(_context);
            label.SetTextColor(Color.Black);
            label.SetText(_values[position].Curso.NomeCurso, TextView.BufferType.Normal);
            return label;
        }

        public override View GetDropDownView(int position, View convertView, ViewGroup parent)
        {
            TextView label = new TextView(_context);
            label.SetTextColor(Color.Black);
            label.SetText(_values[position].Curso.NomeCurso, TextView.BufferType.Normal);
            return label;
        }
    }

Screenshot

0 个答案:

没有答案