示例#1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View itemView = LayoutInflater.From(parent.Context).
                            Inflate(Resource.Layout.listView_accounts, parent, false);
            AccountViewHolder vh = new AccountViewHolder(itemView, OnClick, OnLongClick);

            return(vh);
        }
示例#2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            AccountViewHolder vh = holder as AccountViewHolder;

            vh.AccountName.Text = mItems[position].Name;
            vh.AccountNote.Text = mItems[position].Note;

            //if balanace is 0, text color is black; if balance is greater than 0, text color is green; if balance is less than 0, text color is red
            if (mItems[position].Balance == 0)
            {
                vh.AccountBalance.SetTextColor(Color.Black);
            }
            else if (mItems[position].Balance > 0)
            {
                vh.AccountBalance.SetTextColor(Color.DarkGreen);
            }
            else
            {
                vh.AccountBalance.SetTextColor(Color.Red);
            }
            vh.AccountBalance.Text = "$" + mItems[position].Balance.ToString("0.00");
        }