티스토리 뷰
http://nex-otaku-en.blogspot.kr/2010/12/android-put-listview-in-scrollview.html
listView의 높이를 계산해서 지정해줌으로써 listView내의 scroll은동작안하고
scrollview의 scroll만 동작하게함
이 사람 댓글처럼
listItem.measure(0, 0);
으로 해주는것이 더잘됨
public static void setListViewHeightBasedOnChildren(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter == null) { // pre-condition return; } int totalHeight = 0; for (int i = 0; i < listAdapter.getCount(); i++) { View listItem = listAdapter.getView(i, null, listView); listItem.measure(0, 0); totalHeight += listItem.getMeasuredHeight(); } ViewGroup.LayoutParams params = listView.getLayoutParams(); params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1)); listView.setLayoutParams(params); listView.requestLayout(); } |
- Total
- Today
- Yesterday
- 공연
- Linux
- 인디
- 신주쿠
- 도쿄
- android
- 음악
- 포스트크로싱
- 여행
- 안드로이드
- 사진
- postcrossing
- 락
- 일본
- 아사가야
- 드라마
- 책
- 서울숲별밤축제
- 에픽하이
- 영화
- 진해
- 일기
- 야마다 타카유키
- 잡담
- 코이데 케이스케
- Mac
- 일어일기
- epik high
- Java
- 노래
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |