How can I implement setSelectionFromTop() method list ListView in ExtendableListView?
sungeuns opened this issue · 0 comments
sungeuns commented
Hi, at first I want to appreciate about sharing this awesome library.
I've tried to implement setSelectionFromTop()
method that exist in ListView. So I look into source code of ListView in AOSP, and did it similar way like this in ExtendableLsitView.java :
public void setSelectionFromTop(final int position, int y){
if(mAdapter == null){
return;
}
if(position >= 0){
mLayoutMode = LAYOUT_SPECIFIC;
mSpecificTop = getListPaddingTop() + y;
//Utils.log("what is mSpecificTop : "+mSpecificTop);
if(mNeedSync){
mSyncPosition = position;
mSyncRowId = mAdapter.getItemId(position);
}
mGeneralPurposePosition = position;
requestLayout();
}
}
Also I added layout mode of LAYOUT_SPECIFIC
in layoutChildren() method like below:
case LAYOUT_SPECIFIC:
fillSpecific(mGeneralPurposePosition, mSpecificTop);
break;
It seems like almost work, but the position is different that I thought. (That means it moves to inaccurate position)
Is there any hint about how can I implement setSelectionFromTop() function?
Thanks in advance!