휴대기기용 웹페이지 및 애플리케이션을 개발하는 것은
데스크톱 웹브라우저용
웹페이지 개발까지 다양합니다 다음 관행은
가장 효과적인 웹 애플리케이션을 개발합니다.
휴대기기를 웹사이트의 전용 모바일 버전으로 리디렉션합니다. 여기에는
서버 측 리디렉션을 사용하여
이 작업을 수행하는 방법을 알아보겠습니다. 한 가지 일반적인 방법은
웹브라우저에서 제공하는 사용자 에이전트 문자열입니다. 확인
모바일 버전의 사이트를 제공할지 여부를 결정하려면 '모바일' 문자열에 포함되어야 합니다.
<ph type="x-smartling-placeholder">
HTML5 사용
맞춤설정할 수 있습니다. HTML5는 모바일 웹사이트에 사용되는 가장 일반적인 마크업 언어입니다.
이 표준은 웹사이트가 다양한
기기에서 사용할 수 있습니다. 이전 웹 언어와 달리 HTML5는 더 간단한 <DOCTYPE> 및
charset 선언:
<!DOCTYPEhtml>
...
<metacharset="UTF-8">
표시 영역 메타데이터를 사용하여 웹페이지 크기를 적절하게 조절합니다. 문서
<head>: 브라우저의 표시 영역을 원하는 방식을 지정하는 메타데이터를 제공합니다.
몇 가지 있습니다. 예를 들어, 표시 영역 메타데이터는 광고의 높이와 너비를 지정할 수
초기 페이지 크기 및 타겟 화면 밀도를 변경할 수 있습니다.
Android 지원 기기에 표시 영역 메타데이터를 사용하는 방법을 자세히 알아보려면 웹 앱의 다양한 화면 지원을 참고하세요.
수직 선형 레이아웃을 사용합니다. 사용자가 광고를 좌우로 스크롤하지 않고도
페이지를 탐색할 수 있습니다. 사용자가 위아래로 스크롤하면 더 쉽고 간결한 페이지를 만들 수 있습니다.
레이아웃 높이와 너비를 match_parent로 설정합니다. 설정
WebView 객체의 높이와 너비를 기준으로
match_parent는 앱 뷰의 크기가 올바른지 확인합니다. 따라서
높이를 wrap_content로 변경하면 크기가 잘못 조정되기 때문입니다. 마찬가지로
레이아웃 너비를 wrap_content로 설정하는 것은 지원되지 않으며 WebView이
대신 상위 요소의 너비를 사용하세요. 이러한 동작으로 인해
WebView 객체의 상위 레이아웃 객체에 높이와 너비가 다음과 같이 설정되어 있습니다.
wrap_content입니다.
여러 개의 파일을 요청하지 않습니다. 모바일 장치는 일반적으로 연결 속도가 빠르기 때문에
데스크톱 컴퓨터보다 느린 경우 페이지 로드 속도를 최대한 높이세요. 속도를 높이는 한 가지 방법은
<head>에서 스타일시트 및 스크립트 파일과 같은 추가 파일을 로드하지 마세요.
또한
모바일 분석을 수행한 후
Google의 PageSpeed Insights를 참조하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Best practices for web apps\n\nDeveloping web pages and applications for mobile devices presents different challenges compared\nto developing a web page for desktop web browsers. The following practices can help you provide the\nmost effective web application for Android and other mobile devices.\n\n1. **Redirect mobile devices to a dedicated mobile version of your website.** There are several ways to do this using server-side redirects. One common method is to \"sniff\" the User Agent string provided by the web browser. To determine whether to serve a mobile version of your site, look for the \"mobile\" string in the User Agent.\n| **Note:** Large-screen Android-powered devices that are served full-size websites---such as tablets---don't include the \"mobile\" string in the User Agent, while the rest of the User Agent string is mostly the same. As such, it's important you deliver the mobile version of your website based on whether the \"mobile\" string exists in the User Agent.\n2. **Use [HTML5](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5)\n for mobile devices.** HTML5 is the most common markup language used for mobile websites. This standard encourages mobile-first development to help ensure that websites work on a variety of devices. Unlike previous web languages, HTML5 uses simpler `\u003cDOCTYPE\u003e` and `charset` declarations: \n\n ```xml\n \u003c!DOCTYPE html\u003e\n ...\n \u003cmeta charset=\"UTF-8\"\u003e\n ```\n3. **Use viewport metadata to properly resize your web page.** In your document `\u003chead\u003e`, provide metadata that specifies how you want the browser's viewport to render your web page. For example, your viewport metadata can specify the height and width for the browser's viewport, the initial page scale, and the target screen density.\n\n The following example shows how to set viewport metadata: \n\n ```xml\n \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\"\u003e\n ```\n\n For more information about how to use viewport metadata for Android-powered devices, read [Support different screens in web apps](/guide/webapps/targeting).\n4. **Use a vertical linear layout.** Avoid the need for the user to scroll left and right while navigating your page. Scrolling up and down is easier for the user and makes your page simpler.\n5. **Set the layout height and width to `match_parent`.** Setting your [`WebView`](/reference/android/webkit/WebView) object's height and width to `match_parent` makes sure your app's views are sized correctly. We discourage setting the height to `wrap_content` because it results in incorrect sizing. Similarly, setting the layout width to `wrap_content` isn't supported and causes your `WebView` to use the width of its parent instead. Because of this behavior, it's also important to make sure none of your `WebView` object's parent layout objects have their height and width set to `wrap_content`.\n6. **Avoid multiple file requests.** Because mobile devices typically have a connection speed slower than desktop computers, make your page load as fast as possible. One way to speed it up is to avoid loading extra files such as stylesheets and script files in the `\u003chead\u003e`. Also, consider [performing mobile analysis with\n Google's PageSpeed Insights](https://developers.google.com/speed/docs/insights/v5/get-started) for detailed optimization suggestions specific to your app.\n\nAdditional resources\n--------------------\n\n- [Pixel-Perfect UI in the WebView](https://developers.google.com/chrome/mobile/docs/webview/pixelperfect)\n- [Learn Responsive Design](http://www.html5rocks.com/en/mobile/responsivedesign/)\n- [High DPI images for variable pixel densities](http://www.html5rocks.com/en/mobile/high-dpi/)\n- [Mobile Web Best Practices](http://www.w3.org/TR/mobile-bp/)\n- [Make the Web Faster](https://developers.google.com/speed/overview)"]]