尝试切换布局时android崩溃

时间:2011-07-04 09:36:12

标签: android

我的目标:onclick隐藏主线性布局并在顶部可见

上制作另一个线性布局

这是我的代码我可以运行onclick并使主线性布局隐藏但其他布局不显示

final LinearLayout jamesaionolayout = (LinearLayout) findViewById(R.id.jamesaionolayout);
final ImageView jamesaiono = (ImageView) findViewById(R.id.jamesaiono);


final LinearLayout textlayout = (LinearLayout) findViewById(R.id.text);
 TextView roster = (TextView) findViewById(R.id.jamesaionotext);

 roster.setOnClickListener(new View.OnClickListener() {
     public void onClick(View view) {
         jamesaionolayout.setVisibility (View.VISIBLE);
         jamesaiono.setVisibility (View.VISIBLE);
         textlayout.setVisibility(View.INVISIBLE);
     }

 });

1 个答案:

答案 0 :(得分:0)

将它设为textlayout.setVisibility(View.GONE);