gridview - android Color of the cell on Grid View changes on scrolling -


So I have a grid of text views and it has 228 cells. If a user clicks on the color of the change of cell on any cell on the grid But as soon as I scroll down or take color in another room. I used a customviewview adapter. GetView () is the code.

  See public getView (see the status of the interview, seeviewParent ViewGroup) {LayoutInflater inflater = (LayoutInflater) reference .getSystemService (context.LAYOUT_INFLATER_SERVICE); View grid view; If (convertView == empty) {convertView = inflater.inflate (R.Lite.fingerprintlayout, empty); } TextView tv = (TextView) ConvertviewFindvibid (Rdteviewview); Tv.setText (gridV [position]); // Setting Text (position == getClickedCellPosition ()) {convertView.setBackgroundColor (Color.BLUE); // background color setting} return convertview; } 

Is it really a different cell value or a different cell in layout? Convertview == Empty code is to reuse a scene if it is available. So you can set the color for cell 1,1 but when you scroll, that scene can be reused for 2,1.

There is a problem to make sure that the removal of the blank check and just re-layout does not release your code like this. It is disabled.

What you can do, whether the cash cache is kept or not, when the getView is called, you should reset the background to the default if it represents the cell or it is selected If not, you should highlight it.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -