显示/隐藏android中的Custom ListView [英] Show/Hide the Custom ListView in android
问题描述
任何人都可以指导我如何从我的活动中显示/隐藏自定义ListView(基于BaseAdapter).
Can anybody guide me how can i Show/Hide the Custom ListView (BaseAdapter based) from my Activity.
为了进一步阐述,我有一个具有按钮和LISTVIEW的活动,我有一个内部类MyAdapter与基本适配器一起扩展.
For some more elaboration I have an activty which has a BUTTON and a LISTVIEW, I have an Inner Class MyAdapter extends with Base Adapter.
现在在我的活动显示/隐藏ListView上按一个按钮.
Now pressing a BUTTON on my ACTIVITY SHOW/HIDE the ListView.
任何人都可以指南.
谢谢
推荐答案
只需按一下按钮即可更改ListView
的visibility
.使用此行:
Just change the visibility
of your ListView
on the press of the button. using this line:
listView.setVisibility(View.VISIBLE);
显示. 和:
listView.setVisibility(View.GONE);
隐藏.
您还可以使用:listView.setVisibility(View.INVISIBLE);
隐藏listView,但仍将其放置在屏幕上.
you can also use: listView.setVisibility(View.INVISIBLE);
to hide the listView but still take it's screen place.
这篇关于显示/隐藏android中的Custom ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!