[안드로이드] 웹뷰에 타이틀바 붙이기

안드로이드 웹뷰에 타이틀바 형식으로 특정한 View 를 추가하고자 할 때 WebView 의 setEmbeddedTitleBar 라는 함수를 사용할 수 있습니다.

다만 이 함수는 직접적으로 사용할 수 없기 때문에 아래와 같이 사용해야 합니다.

[important]

        public void setEmbeddedTitleBar(WebView webView, View titlebar) {

               try {

                       Method method = WebView.class.getMethod(“setEmbeddedTitleBar”, new Class[] {View.class});

                       method.invoke(webView, titlebar);

               } catch (Exception ex) {

                       ex.printStackTrace();

               }

        }

[/important]

자세한 동작에 대해서는 안드로이드 기본 웹브라우저 소스를 참고하시면 됩니다. 기본 브라우저 소스는 현재 아래 웹 페이지에서 다운로드 받아서 보실 수 있습니다.

https://github.com/android/platform_packages_apps_browser

 

* 이 글은 2011년에 작성이 되었습니다.

답글 남기기

이메일 주소는 공개되지 않습니다.