显示/隐藏列表视图 [英] Show/hide listview
问题描述
我用我的列表视图活动。现在我需要隐藏的特定时间段的ListView和
那么就需要显示。它类似于我们的视频播放器,其中seekbars而隐藏自动
当用户触摸它会显示类似呐,我需要在我的活动来实现。而不是搜索栏我
需要从screen.Simply显示隐藏我的ListView /隐藏在替代触摸列表视图。是一个newbiew。因此,指导我在实现这一目标。先谢谢了。
I am using listview in my activity. Now i need to hide the listview for a particular period of time and then it needs to display. Its similar to our video players where seekbars while hide automatically and when the user touches it will get display na similar i need to achieve in my activity. Instead of seekbar i need to hide my listview from the screen.Simply show/hide listviews in alternative touches. Am a newbiew. So Guide me in achieving this. Thanks in advance.
推荐答案
您有一些照片喜欢的视频播放器的播放视图。
You have some View like a video player's play view.
View alwaysAppearingView;
和你有你的ListView,要延迟后自动隐藏。
And you have your listView, which you want to hide automatically after delay.
ListView listView;
让我们实现OnTouchListener为alwaysAppearingView;
Let's implement OnTouchListener for the alwaysAppearingView;
alwaysAppearingView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
listView.setVisibility(View.VISIBLE);
listView.postDelayed(new Runnable() {
@Override
public void run() {
listView.setVisibility(View.GONE); // or View.INVISIBLE as Jason Leung wrote
}
}, 3000);
return true;
}
});
您正在检查每个触摸,触摸时,你做的ListView可见,如果你有3000毫秒(3秒),ListView控件正在消失无触动。
试试吧。
You are checking each touch, when touched, you make listView visible and, if you have no touches for 3000 milliseconds (3sec), listView is disappearing. Try it.
这篇关于显示/隐藏列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!