7

I have a scrollview with a list of buttons. I want to have the instructions at the beginning of this list when the app is first used, but then move the instructions to the end off screen after the user has used it once as the instructions won't really be needed again but I still want them accessible. I have no idea where to start!

Edit: Different explanation as requested.

My main layout has a table. The bottom row is a HorizontalScrollView, containing a LinearLayout, containing 6 Buttons. If we call these Buttons 1, 2, 3, 4 ,5 ,6 as they are ordered in the .xml layout, I want in code to be able to reorder them to "6, 1, 2, 3, 4, 5".

Tickled Pink
  • 969
  • 2
  • 14
  • 26
  • Can you be a little more specific in what you want because I can understand what you want to achieve? – hardartcore Jan 02 '13 at 11:56
  • You can use ScrollView Listener.. in that you will have override Methods for scroll starting and ending listener. Try with that . as per that you can show your instructions. – itsrajesh4uguys Jan 02 '13 at 12:08

1 Answers1

19

Just find your views then removethen from linearlayout and add by new order.

ln1= (LinearLayout)findViewById(R.id.ln1);

    btn1= (Button)findViewById(R.id.button1);
    btn2= (Button)findViewById(R.id.button2);
    btn3= (Button)findViewById(R.id.button3);
    btn4= (Button)findViewById(R.id.button4);
    btn5= (Button)findViewById(R.id.button5);
    btn6= (Button)findViewById(R.id.button6);

    ln1.removeAllViews();

    ln1.addView(btn6);
    ln1.addView(btn1);
    ln1.addView(btn2);
    ln1.addView(btn3);
    ln1.addView(btn4);
    ln1.addView(btn5);
Talha
  • 12,673
  • 5
  • 49
  • 68