单击后如何使 textView 不可见 [英] How can I make textView invisible after one click
本文介绍了单击后如何使 textView 不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何使多个 texView
在单击时不可见,并且仅使用一个 onclick 侦听器根本不会显示.
I would like to know how to make multiple texView
invisible when clicked on it won't be shown at all using only one onclick listener.
推荐答案
检查这个
final List<TextView> textViewsToHide = Arrays.asList(
findViewById(R.id.tvFirst),
findViewById(R.id.tvSecond),
findViewById(R.id.tvThird),
.....
);
final View.OnClickListener textViewOnClickListener = view -> {
for (TextView textView : textViewsToHide) {
textView.setVisibility(View.GONE);
}
};
for (TextView textView : textViewsToHide) {
textView.setOnClickListener(textViewOnClickListener);
}
这篇关于单击后如何使 textView 不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文