안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요?
현재 버튼 5개를 framelayout에 중앙 정렬 한 후에
액티비티 실행시 4개의 버튼을 TranslateAnimation 효과를 주어
좌/우/상/하로 이동하려고 합니다.
버튼의 크기는 모두 동일하고, 버튼의 넓이만큼 이동하려고 합니다.
그런데 아래처럼 구현했는 데, 버튼의 넓이만큼 이동하지 않네요.
다른 방법이 없을 까 싶어 도움 요청드립니다.
즐거운 하루 보내세요~^^
int centerHeight = centerMenuBtn.getHeight();
TranslateAnimation topTranslate=new TranslateAnimation(0,0,0,-centerHeight);
topTranslate.setDuration(1000);
topTranslate.setFillAfter(true);
topMenuBtn.startAnimation(topTranslate);
topTranslate.setDuration(1000);
topTranslate.setFillAfter(true);
topMenuBtn.startAnimation(topTranslate);




액티비티 실행시 라는 개념이 onCreate ? onResume? 인가요?
onResume 후에 뷰의 레이아웃이 결정되는것으로 알고 있습니다. 그러므로 getWidth와 같은 뷰의 사이즈는 해당 시점에서 리턴값이 0입니다.