Need to hide text box when scrolling grid
6 answers
implement OnScrollListener, and then internally onScroll
make the textView invisible and in the OnScrollStateChanged method, check if the scroll is paused and visible again.
private OnScrollListener mScrollListener = new OnScrollListener() {
@Override
public void onScrollStateChanged(ViewGroup view, int scrollState) {
if(scrollState == SCROLL_STATE_IDLE)
{
textView.setVisibility = View.VISIBLE;
}
@Override
public void onScroll(ViewGroup view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
textView.setVisibility = View.INVISIBLE
}
};
0
source to share
You need set this method on your gridview.
this works for me. I'm sure this will help you.
gridAdmin.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if(scrollState == SCROLL_STATE_IDLE)
{
text1.setVisibility = View.VISIBLE;
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
text1.setVisibility = View.INVISIBLE
}
});
0
source to share
Try this code:
private OnScrollListener mScrollListener = new OnScrollListener() {
@Override
public void onScrollStateChanged(ViewGroup view, int scrollState) {
if(scrollState == SCROLL_STATE_IDLE)
{
tv.setVisibility(View.VISIBLE);
}
}
@Override
public void onScroll(ViewGroup view, int firstVisibleItem, int visibleItemCount, int totalount)
{
tv.setVisibility(View.INVISIBLE);
}
});
0
source to share
You can use setVisibility
inOnScrollListener
Example:
gridview.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if(scrollState == SCROLL_STATE_IDLE)
{
textview.setVisibility(View.VISIBLE);
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
textview.setVisibility(View.GONE);
}
});
Hope it helps.
0
source to share
gridView.setOnScrollListener (new OnScrollListener () {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if(scrollState == SCROLL_STATE_IDLE)
{
textview.setVisibility(View.VISIBLE);
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
textview.setVisibility(View.GONE);
}
});
We are using this code in my application and it works, I hope you find it helpful.
0
source to share
Try the following:
Private OnScrollListener mScrollListener = new OnScrollListener() {
@Override
public void onScrollStateChanged(ViewGroup view, int scrollState) {
if(scrollState == SCROLL_STATE_IDLE)
{
mTextView.setVisibility = View.VISIBLE;
}
@Override
public void onScroll(ViewGroup view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
mTextView.setVisibility = View.INVISIBLE
}
};
0
source to share