smoothScrollToPositionFromTop (int position, int offset) > 안드로이드 플랫폼 지식 공유

본문 바로가기
사이트 내 전체검색


회원로그인

My IP : 54.163.61.66
[Sponsor]
DNS Powered by DNSEver.com



[Admin Email]

* 문서저장소 바로가기 *
* 2015년 이전 웹페이지 *

[안드로이드 모바일앱 - 무료]
1. 정각알림(OnTimeAlarm)
2. 알람포미(Alarm4Me)
3. 언인스톨러포미
4. 와이파이온오프포미
5. 리코더포미
6. 배터리포미
7. 폴더플레이어포미
8.
볼륨맨포미
9. 바빠요!
10. 메모포미
11. 파일맨포미
12. 플래시온
안드로이드 플랫폼 지식 공유

smoothScrollToPositionFromTop (int position, int offset)

페이지 정보

작성자 LUG 작성일14-12-05 15:57 조회5,581회 댓글0건

본문

public void smoothScrollToPositionFromTop (int position, int offset)

Added in API level 11 

 

Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayed offset pixels below the top edge of the view. If this is impossible, (e.g. the offset would scroll the first or last item beyond the boundaries of the list) it will get as close as possible.

 

Parameters

position Position to scroll to

offset Desired distance in pixels of position from the top of the view when scrolling is finished 

 

public void smoothScrollToPosition (int position)

Added in API level 8

 

Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayed.

 

Parameters

position Scroll to this adapter position. 

 

public void setSelectionFromTop (int position, int y)

Added in API level 1

 

Sets the selected item and positions the selection y pixels from the top edge of the ListView. (If in touch mode, the item will not be selected but it will still be positioned appropriately.)

 

Parameters

position Index (starting at 0) of the data item to be selected.

y The distance from the top edge of the ListView (plus padding) that the item will be positioned. 

 

===

 

try {

if (Build.VERSION.SDK_INT >= 11) {

main_lv_filelist.smoothScrollToPositionFromTop(pos, 0);

} else if (Build.VERSION.SDK_INT >= 8) {

int firstVisible = main_lv_filelist.getFirstVisiblePosition();

   int lastVisible = main_lv_filelist.getLastVisiblePosition();

   if (pos < firstVisible) {

main_lv_filelist.smoothScrollToPosition(pos);

   } else {

main_lv_filelist.smoothScrollToPosition(pos + lastVisible - firstVisible - 2);

   }

} else {

main_lv_filelist.setSelectionFromTop(pos, 0);

}

} catch (Exception e) {} 

댓글목록

등록된 댓글이 없습니다.


접속자집계

오늘
131
어제
156
최대
627
전체
160,724
한국LUG 소프트웨어 커뮤니티 : http://www.lug.or.kr

커뮤니티소개 개인정보취급방침 서비스이용약관 Copyright © www.lug.or.kr. All rights reserved.
상단으로
모바일 버전으로 보기