Android WebView 에서 가로 세로 Rotate 전환시에 웹뷰가 새로고침 되는 현상 > 개발

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

개발

Android WebView 에서 가로 세로 Rotate 전환시에 웹뷰가 새로고침 되는 현상

페이지 정보

profile_image
작성자 관리자 (112.♡.173.204)
댓글 0건 조회 4,530회 작성일 21-05-19 12:12

본문

## 가로 세로 방향 전환

기본적으로 화면 방향 전환을 하면, Activity를 다시 시작한다고 한다. 아래처럼 차례대로 호출된다고 한다.

onDestroy() 후 onCreate()



## 방법1 : Activity 를 다시 시작하지 않게 하기.

Manifest 파일의 activity 에 아래처럼 android:configChanges 를 추가한다.
```
<activity android:name=".MyActivity"
        android:configChanges="orientation|keyboardHidden|screenSize">
```


## 방법2 : 화면 방향을 고정해 버리기.

역시, Manifest 파일의 activity 에 아래처럼 android:screenOrientation 를 지정해 버린다.
가로는 landscape, 세로는 portrait
```
<!-- 가로 landscape, 세로 portrait -->
<activity android:name=".MyActivity"
        android:screenOrientation="portrait">
```


## 참고
https://developer.android.com/guide/topics/manifest/activity-element
https://cofs.tistory.com/206
https://miniweb4u.tistory.com/6

추천0

댓글목록

등록된 댓글이 없습니다.

Total 386건 3 페이지
  • RSS
개발 목록
번호 제목 조회 추천 날짜
3463261006-15
3451828005-04
3441557003-11
3432039003-04
3421957002-21
3412136002-20
3402301002-18
3391811002-15
3381656002-13
3372173002-08
3361669002-08
3351704002-03
3341613001-31
3332722001-29
3321646001-28
3311505001-13
3301763012-23
3292481012-20
열람중4531005-19
3273738005-15

검색


사이트 정보

Copyright © Baragi.Net. All rights reserved.