简体   繁体   English

尝试切换布局时 android 崩溃

[英]android crash when trying to switch layouts

My goal: onclick hide main linearlayout and make another linearlayout with picture on top visible我的目标:onclick 隐藏主要的线性布局并制作另一个线性布局,顶部有图片

Here is my code I can run the onclick and have the main linearlayout hide but the other layout doesn't showup这是我的代码,我可以运行 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);
     }

 });

make it this textlayout.setVisibility(View.GONE);使它成为 textlayout.setVisibility(View.GONE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM