-1

i made code that populate listView from EditText view and enter it on button and it all work, BUT when i want to animate new item, that i just entered from EditText i can not do it, because i can not capture moment when listView get that new View. Here how that look:

listaRadnikaArray.add(0,novoIme.getText().toString());
adapter.notifyDataSetChanged(listaRadnikaArray);    
LayoutInflater inflator = getLayoutInflater();
v = inflator.inflate(R.layout.listview_podesavanje, null);
View noviRadnikView = lvRadnici.getChildAt(0);        //this return null or wrong view                                              
noviRadnikView.setAlpha(0);                           // because  listView lvRadnici do not have that new view jet.                           
noviRadnikView.animate().setDuration(500).alpha(1);      // why????

can anyone, please , explain to me what is a problem.

CrazyFox
  • 37
  • 1
  • 7

1 Answers1

0

here some solution of this problem How can you tell when a layout has been drawn? or When Can I First Measure a View?

or there is example from DevByts https://www.youtube.com/watch?v=1wyhY68esZY

and who ever put negativ vote on question is noob, because i spend a lot of time to find solution and it is not simple problem.

Community
  • 1
  • 1
CrazyFox
  • 37
  • 1
  • 7