如果用户向下滚动列表视图,我想让 tabhost 的选项卡淡出
我有以下代码,但它不起作用
ListView ls = (ListView) findViewById(R.id.list);
ls.setOnScrollListener(new OnScrollListener() {
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
int previousVisible = 3;
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (previousVisible < firstVisibleItem) {
getParent().findViewById(android.R.id.tabhost)
.setVisibility(View.INVISIBLE);
} else {
getParent().findViewById(android.R.id.tabhost)
.setVisibility(View.VISIBLE);
}
previousVisible = firstVisibleItem;
}
});