I am new to android development and I want to programatically add LinearLayout views to the parent LinearLayout. And while doing so , I want to see them sequentially. That is the view that gets added first should be first , the view that is added second should be second and so on. I tried doing it with
HolderLayout.addView(view, index)
where index goes on incrementing, but it is not working for me. The view that i add first is shown second in the list. What should I do? Outline of my code is :
int index = 0;
View Row1 = View.inflate(this, R.layout.childView, null);
//populate the appropriate data on the child Row and add it to the holder layout.
holder_layout.addView(Row1 , index);
index++;
Set<Integer>keys = MyMap.keySet();
for(int i : keys){
View row = View.inflate(this,
R.layout.childView, null);
holder_layout.addView(row , index);
index++;
}
where am I going wrong.
0 comments:
Post a Comment