ListView add the colour of each paragraph and remember



  • I have String[] colors and GridView, every puncture I ask color.

    The question is how to make every paragraph remember its color after GridView?

    private String[] colors = null;
    colors = new String[] {"#4BBEBA","#69CCE3","#7277C1","#ffffDD","#FACE4C","#EF6960","#E63F84","#2F6175","#444646"};
    LinearLayout mainLayout;
    mainLayout = (LinearLayout) convertView.findViewById(R.id.lineartext);
    mainLayout.setBackgroundColor(Color.parseColor(colors[position]));`
    


  • You need to:

    1. Store a set of colours/lists in the adapter for each list/table element.
    2. In the element ' s drawing method (getView()() Install the colour of the position.

    So the colours of the elements will be maintained at the re-establishment of the omen.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2