【发布时间】:2015-08-30 06:54:17
【问题描述】:
实际上我想将其设为 Random 类,但我认为过多的活动会使应用程序变慢,所以我只想将相对布局设为 Random
所以我在一个活动类中有 5 个布局
layout1 = (RelativeLayout)findViewById(R.id.layout1);
layout2 = (RelativeLayout)findViewById(R.id.layout2);
layout3 = (RelativeLayout)findViewById(R.id.layout3);
layout4 = (RelativeLayout)findViewById(R.id.layout4);
layout5 = (RelativeLayout)findViewById(R.id.layout5);
在每个布局中都有一个按钮可以再次使布局随机化
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
//The code to how make layout random
}
});
}
然后如果随机按下按钮,如何使已经打开的布局不再打开?那么如果所有布局都已经打开,它将打开新的活动类
谁能帮我解释一下,给出一些示例代码?
【问题讨论】:
-
如何打开一个新的
RelativeLayout? -
看看我的骨架
标签: java android android-layout random