Thanks for reply
i think u replied my each and every post
thanks once again.
Now I want to explain you in detail what i am trying to do
I have created one question screen by using Linear Layout
like this
I have used text view for displaying Question and Answers
What I Want ?
when user click on Answers A
the current view will replaced with new view with new question and answer.
the new view contains any number of answers like 2 or 5
like this
in short
i want to switch the new view when user clicks on answer.(with animation but this is not important)
I have used view Animator but am not able to create dynamic child for view animator
because for view animator we have to define all child's in XML layout and i don't want to use any XML dependency.
please help me !!!!!!
satishkumar_lskin wrote:Hi,
For ur requirement , u can use a single linear layout and add child views to it whenever u need a new View.
Say for example ,
Using java Syntax Highlighting
LinearLayout parent = new LinearLayout ( context );
parent.setLayoutParams(width, height ); //width, height can be set as needed.
parent.addView(myView , 0 );
Parsed in 0.040 seconds, using
GeSHi 1.0.8.4
When u have formed a new LinearLayout as the next View , it can be added as the child to the parent .
Now,
Using java Syntax Highlighting
parent.addView(newLinearLayout, 0 );
Parsed in 0.037 seconds, using
GeSHi 1.0.8.4
You can remove the previous View that u had added to the parent first by calling
Using java Syntax Highlighting
parent.removeViewAt(1);
Parsed in 0.035 seconds, using
GeSHi 1.0.8.4
because after the new child was added , the previous view would have now become the second (index = 1 ) child.
You can apply the above logic whenever u have to display a new View.
Regards,
Satish