本文整理了Java中android.widget.ListView.setSelectionFromTop()
方法的一些代码示例,展示了ListView.setSelectionFromTop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.setSelectionFromTop()
方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:setSelectionFromTop
暂无
代码示例来源:origin: wangdan/AisenWeiBo
@Override
public void run() {
getRefreshView().setSelectionFromTop(0, 0);
}
}, 20);
代码示例来源:origin: scwang90/SmartRefreshLayout
public static void scrollListBy(@NonNull AbsListView listView, int y) {
if (Build.VERSION.SDK_INT >= 19) {
// Call the framework version directly
listView.scrollListBy(y);
} else if (listView instanceof ListView) {
// provide backport on earlier versions
final int firstPosition = listView.getFirstVisiblePosition();
if (firstPosition == ListView.INVALID_POSITION) {
return;
}
//noinspection UnnecessaryLocalVariable
final ViewGroup listGroup = listView;
final View firstView = listGroup.getChildAt(0);
if (firstView == null) {
return;
}
final int newTop = firstView.getTop() - y;
((ListView) listView).setSelectionFromTop(firstPosition, newTop);
} else {
listView.smoothScrollBy(y, 0);
}
}
代码示例来源:origin: wangdan/AisenWeiBo
@Override
public boolean onToolbarDoubleClick() {
if (AisenUtils.checkTabsFragmentCanRequestData(this)) {
requestDataDelaySetRefreshing(AppSettings.REQUEST_DATA_DELAY);
getRefreshView().setSelectionFromTop(0, 0);
return true;
}
return false;
}
代码示例来源:origin: wangdan/AisenWeiBo
@Override
public boolean onToolbarDoubleClick() {
if (AisenUtils.checkTabsFragmentCanRequestData(this)) {
Fragment fragment = getActivity().getFragmentManager().findFragmentByTag(SinaCommonActivity.FRAGMENT_TAG);
if (fragment != null && fragment instanceof TimelineDetailPagerFragment) {
((TimelineDetailPagerFragment) fragment).swipeRefreshLayout.setRefreshing(true);
}
requestDataDelaySetRefreshing(AppSettings.REQUEST_DATA_DELAY);
getRefreshView().setSelectionFromTop(0, 0);
return true;
}
return false;
}
代码示例来源:origin: wangdan/AisenWeiBo
@Override
public boolean onToolbarDoubleClick() {
if (AisenUtils.checkTabsFragmentCanRequestData(this)) {
Fragment fragment = getActivity().getFragmentManager().findFragmentByTag(SinaCommonActivity.FRAGMENT_TAG);
if (fragment != null && fragment instanceof TimelineDetailPagerFragment) {
((TimelineDetailPagerFragment) fragment).swipeRefreshLayout.setRefreshing(true);
}
requestDataDelaySetRefreshing(AppSettings.REQUEST_DATA_DELAY);
getRefreshView().setSelectionFromTop(0, 0);
return true;
}
return false;
}
代码示例来源:origin: wangdan/AisenWeiBo
public void show() {
int top = 0;
if (getRefreshView().getChildCount() > 0 && getRefreshView().getChildAt(0).getHeight() > 0) {
top = getRefreshView().getChildAt(0).getHeight() * 3;
}
else {
top = Utils.dip2px(getActivity(), 175);
}
getRefreshView().setSelectionFromTop(selectedPosition, top);
}
代码示例来源:origin: stackoverflow.com
mList.setSelectionFromTop(index + mListOffset, 0);
} else {
int index = (int) (position * count);
mList.setSelectionFromTop(index + mListOffset, 0);
sectionIndex = -1;
代码示例来源:origin: facebook/facebook-android-sdk
listView.setSelectionFromTop(newPositionOfItem, top);
代码示例来源:origin: ukanth/afwall
this.listview.setAdapter(new AppListArrayAdapter(this, getApplicationContext(), apps2));
this.listview.setSelectionFromTop(index, top);
代码示例来源:origin: ukanth/afwall
appAdapter.notifyDataSetChanged();
this.listview.setSelectionFromTop(index, top);
代码示例来源:origin: matrix-org/matrix-android-sdk
@Override
// require to avoid lint errors with MatrixMessageListFragment
public void setSelectionFromTop(int position, int y) {
super.setSelectionFromTop(position, y);
}
}
代码示例来源:origin: huangfangyi/YiChat
private void completeBackToTop(){
mListView.setTranslationY(0);
int num = mListView.getAdapter().getCount() - mLastCount;
Log.v("czm","num="+num);
if(num > 0){
mListView.setSelectionFromTop(num, (int) mLastTranslationY);
}
}
public void onRefreshComplete(){
代码示例来源:origin: KishanV/Android-Music-Player
@Override
public void onClose(boolean isOpen) {
if(SelectBack != null && isOpen){
Ui.bk.back();
}
listview.setSelectionFromTop(cItemNo,cItemY);
}
代码示例来源:origin: BuildmLearn/BuildmLearn-Toolkit-Android
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
View v = view.getChildAt(0);
if (v != null)
listViewA.setSelectionFromTop(firstVisibleItem, v.getTop());
}
});
代码示例来源:origin: KishanV/Android-Music-Player
@Override
public void onClose(boolean isOpen) {
if(SelectBack != null && isOpen){
Ui.bk.back();
}
listview.setSelectionFromTop(cItemNo,cItemY);
}
代码示例来源:origin: KishanV/Android-Music-Player
@Override
public void onClose(boolean isOpen) {
if(SelectBack != null && isOpen){
Ui.bk.back();
}
listview.setSelectionFromTop(cItemNo,cItemY);
}
代码示例来源:origin: stackoverflow.com
private void resetListView(ListView lv)
{
int position = lv.getFirstVisiblePosition();
int y = lv.getChildAt(0).getTop();
lv.setAdapter(lv.getAdapter());
lv.setSelectionFromTop(position, y);
}
代码示例来源:origin: sismics/reader
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Constants.REQUEST_CODE_ARTICLES && resultCode == Activity.RESULT_OK) {
// We are coming back from the articles pager, scroll to the last viewed
ListView articleList = aq.id(R.id.articleList).getListView();
articleList.setSelectionFromTop(data.getIntExtra("position", 0), 100);
}
}
代码示例来源:origin: huangfangyi/YiChat
@Override
public void run() {
int listviewHeight = actualListView.getMeasuredHeight();
MomentsItemView momentsItemView = adapter.getItemView(position);
int itemHeight = momentsItemView.getMeasuredHeight();
actualListView.setSelectionFromTop(position + 2, listviewHeight - itemHeight);
}
}, 1000);
代码示例来源:origin: kebernet/shortyz
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
arg0.setSelected(true);
ShortyzApplication.getInstance().getBoard().jumpTo(arg2, true);
imageView.scrollTo(0, 0);
render();
if (prefs.getBoolean("snapClue", false)) {
across.setSelectionFromTop(arg2, 5);
across.setSelection(arg2);
}
}
});
内容来源于网络,如有侵权,请联系作者删除!