슬라이드 인 탐색 (Facebook, 경로 또는 Google+ Android 앱)을 구현하려고합니다. 이 버그를 재현하는 완전한 소스 can be found here.기기의보기 애니메이션을 적용하는 동안 Android WebView 깜박임 버그
그러나 장치에서 화면에서 WebView
을 움직이게 할 때 깜박임은 마치 장치가 화면 밖으로 밀어 내기 전에 내 WebView
에서 물기를 빼내는 것처럼 깜박입니다.
이슈를 에뮬레이터 발생하지 않습니다! 애니메이션이 부드럽게 진행됩니다.
흥미롭게도,이 깜박이는 애니메이션되는 뷰가 WebView
때에 만 발생하는 것 같습니다! 다음은 TextView를 주요 콘텐츠보기로 사용하는 동일한 프로젝트입니다. 웹보기 활동에 대한
레이아웃 :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blue" >
<TextView
android:id="@+id/web_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello there. no flicker!"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
코드에 탐색 메뉴를 슬라이드라고 :
private void slideIn() {
LinearLayout actionBarFrame = (LinearLayout) findViewById(android.R.id.content).getParent();
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
menuView = inflater.inflate(R.layout.menu, null);
menuView.setLayoutParams(new FrameLayout.LayoutParams(SIZE, LayoutParams.MATCH_PARENT, Gravity.LEFT));
FrameLayout decorView = (FrameLayout) getWindow().getDecorView();
decorView.addView(menuView);
decorView.bringChildToFront(actionBarFrame);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) actionBarFrame.getLayoutParams();
params.setMargins(SIZE, 0, -SIZE, 0);
actionBarFrame.setLayoutParams(params);
TranslateAnimation ta = new TranslateAnimation(-SIZE, 0, 0, 0);
ta.setDuration(DURATION);
actionBarFrame.startAnimation(ta);
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blue" >
<WebView
android:id="@+id/web_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
그리고 텍스트 뷰 활동에 대한
,210그리고 밖으로 다시 밀어 : 당신은 내가 가진 그대로이 프로젝트를 시도 할 수 있도록
private void slideOut() {
LinearLayout actionBarFrame = (LinearLayout) findViewById(android.R.id.content).getParent();
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) actionBarFrame.getLayoutParams();
params.setMargins(0, 0, 0, 0);
actionBarFrame.setLayoutParams(params);
TranslateAnimation ta = new TranslateAnimation(SIZE, 0, 0, 0);
ta.setDuration(DURATION);
ta.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation arg0) {
((FrameLayout) getWindow().getDecorView()).removeView(menuView);
menuView = null;
}
@Override public void onAnimationRepeat(Animation arg0) { }
@Override public void onAnimationStart(Animation arg0) { }
});
actionBarFrame.startAnimation(ta);
}
나는 공공의 repo로 BitBucket에 코드를 업로드했습니다.
왜 이런 일이 발생했는지 또는 해결 방법에 대한 도움이나 의견이 있으면 대단히 감사하겠습니다. 원하는 것은 WebView
을 그림 밖으로 부드럽게 움직여 다시 넣는 것입니다. 감사합니다!
여기에서 같은 문제가 발생합니다. @ 로버트가 이것을위한 해결책을 찾았습니까? – jayellos
@jayellos이 문제에 대한 두 가지 잠재적 수정 사항이 있습니다. 아래에 답변을 추가하겠습니다 만,이 이야기의 도덕적 인면은 'WebView'에서 하드웨어 가속을 사용하면 (일부 플랫폼에서는 기본적으로 켜지지 않음) 또는 [이 라이브러리] (https : // github. com/jfeinstein10/SlidingMenu) (현재 해결책). –