Guest User

Untitled

a guest
Oct 19th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. ........
  2. int select;
  3.  
  4. public void setSelect(int select){
  5. this.select = select;
  6. }
  7. @Override
  8. public View getView(int position, View convertView, ViewGroup parent) {
  9. LayoutInflater inflater = (LayoutInflater) context
  10. .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  11. View rowView = inflater.inflate(R.layout.item_2colum_1_1, parent, false);
  12. TextView textView = (TextView) rowView.findViewById(R.id.tvNameGroup);
  13. TextView textView1 = (TextView) rowView.findViewById(R.id.tvBeginEnadNumber);
  14. Groups item = values.get(position);
  15. textView.setText(item.getName());
  16. textView1.setText(item.getMin() + " - " + item.getMax());
  17. if(position%2 == 0){
  18. textView.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.tvborder_color));
  19. textView1.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.tvborder_color));
  20.  
  21. }
  22. if(position == select){
  23. textView.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.tvborder_select));
  24. textView1.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.tvborder_select));
  25. }
  26.  
  27. return rowView;
  28. }
  29.  
  30. ........
  31.  
  32. @Override
  33. public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  34. iSelect = position;
  35. groupsAdapter.setSelect(iSelect);
  36. listGroups.invalidateViews();
  37. }
Add Comment
Please, Sign In to add comment