简体   繁体   English

带有SwipeyTabs的setVisibility(View.Gone)

[英]setVisibility(View.Gone) with SwipeyTabs

I'm a beginner android programmer, and I'm trying to figure out how to work with SwipeyTabs. 我是一名初学者,所以我想弄清楚如何使用SwipeyTabs。 First of all, is this a good way to find the view: 首先,这是查找视图的好方法:

rb2 = (RadioButton) getView().findViewById(R.id.rb2); rb2.setOnClickListener(this);

My second question is about how to set the visibility of a TextView or an EditText with SwipeyTabs. 我的第二个问题是关于如何使用SwipeyTabs设置TextView或EditText的可见性。 I've made a simple application without SwipeyTabs, and there I use the code: 我做了一个没有SwipeyTabs的简单应用程序,在这里我使用了代码:

tvPlayer1.setVisibility(View.GONE);

Once I use this same line of code within SwipeyTabs, it crashes. 一旦我在SwipeyTabs中使用同一行代码,它就会崩溃。 Can someone explain me why I can't get this to work? 有人可以向我解释为什么我无法使它正常工作吗?

Thank you in advance! 先感谢您!

Turned out I had a grammar mistake in my line of code. 原来我的代码行中有语法错误。

etPlayer1 = (TextView) getView().findViewById(R.id.etPlayer1);

had to be: 必须是:

etPlayer1 = (EditText) getView().findViewById(R.id.etPlayer1);

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

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