일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- onScrollToIndexFailed
- 리액트네이티브
- 안드로이드
- baseurl 오류
- unable to resolve module
- React Native
- Android
- react native lodash
- 라이브러리 커스텀
- privacy manifest
- 하우스플리퍼
- Graveyard Keeper
- 리액트 네이티브 ios
- removeClippedSubviews
- react native hooks
- 하우스플리퍼인테리어
- hermes engine
- Kotlin
- patch package
- RecyclerView
- react native privacy manifest
- react native hook
- 리액트 네이티브 헤르메스
- 헤르메스 엔진
- react
- 스팀게임추천
- ReactNative
- tsconfig baseurl
- 리액트네이티브 라이브러리 커스텀
- 리액트네이티브 hooks
Archives
- Today
- Total
숨참고 개발다이브
[안드로이드/java] BottomSheet 스크롤 할 때 slideOffset 으로 background 조절 본문
개발/Android
[안드로이드/java] BottomSheet 스크롤 할 때 slideOffset 으로 background 조절
사라 Sarah 2019. 4. 13. 22:19728x90
int colorFromTop = getResources().getColor(R.color.downy);
int colorFromBottom = getResources().getColor(R.color.scooter);
int colorTo = getResources().getColor(R.color.transparent);
int[] colors = {interpolateColor(slideOffset, colorFromTop, colorTo), interpolateColor(slideOffset, colorFromBottom, colorTo)};
GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colors);
gd.setCornerRadii(new float[]{radius, radius, radius, radius, 0, 0, 0, 0});
act.layoutIntroPeek.setBackground(gd);
background 가 gradient 도 있고 상단 corner도 있어서 작업하였다.
참조한 코드
https://android.jlelse.eu/choreographic-animations-with-androids-bottomsheet-fef06e6ecb81
private int interpolateColor(float fraction, int startValue, int endValue) {
int startA = (startValue >> 24) & 0xff;
int startR = (startValue >> 16) & 0xff;
int startG = (startValue >> 8) & 0xff;
int startB = startValue & 0xff;
int endA = (endValue >> 24) & 0xff;
int endR = (endValue >> 16) & 0xff;
int endG = (endValue >> 8) & 0xff;
int endB = endValue & 0xff;
return ((startA + (int) (fraction * (endA - startA))) << 24) |
((startR + (int) (fraction * (endR - startR))) << 16) |
((startG + (int) (fraction * (endG - startG))) << 8) |
((startB + (int) (fraction * (endB - startB))));
}
300x250
'개발 > Android' 카테고리의 다른 글
[안드로이드/Kotlin] RecyclerView를 이용한 GridView 생성하기 (GridLayoutManager) (0) | 2022.05.26 |
---|---|
[안드로이드/java]scrollview 안에 recyclerview 스크롤 문제 (0) | 2019.08.02 |
[안드로이드] TextView 한 줄만 표시하기 (뒷 부분 ... 으로 생략) (0) | 2019.01.16 |
[안드로이드/java] 안드로이드 웹뷰 캐시 삭제 (0) | 2019.01.07 |
[안드로이드] EditText 키보드 다음/완료 등 엔터 버튼 변경 (0) | 2019.01.03 |
Comments