问题描述
我有一个按钮列表滚动型。我想在有首次使用时,应用此列表开头的指令,但然后将指令结束戏外用户已使用一次后的指令不会真的再需要不过我还是想他们访问。我不知道从哪里开始!
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!
编辑:根据要求不同的解释
Different explanation as requested.
我主要布局有一个表。最下面一行是HorizontalScrollView,包含的LinearLayout,包含6个按键。如果我们称这些按钮1,2,3,4,5,6,因为它们是在该.xml布局有序的,我想在code键能够重新排序为6,1,2,3,4 5。
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".
推荐答案
刚刚从LinearLayout中找到自己的看法,然后removethen和新订单增加。
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);
这篇关于机器人:如何以编程方式重新排序linearlayouts内容是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!