Langsung ke konten

Paling sering dikunjungi

Terakhir dikunjungi


Optimizing Apps for Chrome OS

Android apps have an important role to play in redefining what modern computing looks like on large screens. That said, simply porting your phone app to Chromebooks won't give your users the best experience. This page details some ways that you can tailor your experience towards laptop and convertible form factors.

Leverage support for free-form multi-window

The implementation of Android apps on Chrome OS includes basic multi-window support. Instead of always taking up the full screen, Android renders apps on Chrome OS into free-form window containers that are appropriate for this form factor, as shown in figure 1.

Figure 1. An app in different window sizes

Users can resize the window that hosts your Android app, as shown in figure 2. To ensure that your free-form windows resize smoothly and are able to display their entire contents to the user, read the guidelines and things to watch out for in Screen Size Compatibility for Chromebooks.

Figure 2. A resizable app window

You can improve the user experience when your app runs on Chrome OS by following these best practices:

For more information, read about window management.

Customize the top bar color

Chrome OS uses the app theme to color the top bar displayed on top of the app, which shows when users hold the window controls and the back button. To make your app look polished and customized for Chrome OS, define colorPrimary and (if possible) colorPrimaryDark values in your app's theme. The latter is used to color the top bar. If only colorPrimary is defined, Chrome OS uses a darker version of it in the top bar. For more information, see Using the Material Theme.

Support the keyboard, trackpad, and mouse

All Chromebooks have a physical keyboard and a trackpad, and some have a touchscreen as well. Some devices can even convert from laptop to tablet form.

All apps for Chrome OS should support mouse, trackpad and keyboard and be usable without a touchscreen. Many apps already support mouse and trackpad with no extra work required. However, it's always best to customize your app's behavior appropriately for mouse, and you should support and distinguish between mouse and touch inputs. Read more about mouse support in Input compatibility for Chromebooks.

You should ensure that:

Figure 3. Scrolling with mouse wheel

Figure 4. Button hover states

Where appropriate, you should differentiate between mouse and touch inputs. For example, tapping an item could trigger a multi-select UI while clicking the same item could trigger a single selection instead.

Custom cursors

Apps should customize mouse cursors to indicate what element of their UI can be interacted with and how. You can set the PointerIcon to use when users interact with a view by calling the setPointerIcon() method.

Apps should show:

The PointerIcon class provides constants that you can use to implement custom cursors.

Keyboard shortcuts and navigation

Since every Chromebook has a physical keyboard, you should provide hotkeys to allow your users to be more productive. For example, if your app supports printing, you could use Control+P to open a print dialog. Similarly, all crucial UI should also be handled by tab navigation. This is especially important for accessibility. To meet accessibility standards, however, all UI surfaces should have obvious and accessibility-compliant focused states.

Figure 5. Transversal tabbing

Figure 6. Replacing a swipe gesture with a control that appears on hover

You should also make sure to implement keyboard or mouse alternatives to core features hidden under touch-specific interactions, such as long presses, swipes, or other multi-touch gestures. An example solution would be to provide buttons that appear on a surface on hover.

Further enhance user input

To attain desktop grade functionality for your app, consider these extra, productivity-oriented inputs.

Context menus

Figure 7. A context menu appearing on right click

Android context menus, which are another accelerator for taking users to features of your app, can be triggered by a click of a mouse or trackpad's secondary button, or through a long press on a touchscreen.

Drag and drop

Figure 8. Drag and drop in a file tree interface

Building drag and drop interactions can bring efficient, intuitive productivity functionality to your app. For more information, see Drag and Drop.

Stylus support

Stylus support is crucial for drawing and note taking apps. Provide enhanced support for stylus-equipped Chromebooks and tablets by implementing interactions tailored to the usage of stylus input. Be considerate of the potential variations in different stylus hardware when designing your stylus interactions. See Input Compatibility for Chromebooks for an outline of the stylus APIs.

Make your layouts responsive

Your app should make good use of the screen real estate available regardless of the visual state (fullscreen, portrait, landscape, windowed). Some examples of good space usage include but are not limited to:

As your app becomes increasingly customized for a laptop environment, consider moving towards a navigation pattern that de-emphasizes the back button. The app should be able to handle its own history stack by providing in-app back buttons, breadcrumbs, or other escape routes like close or cancel buttons as part of its large screen UI. A system-level back button is a pattern carried over from Android's handheld roots—one that doesn't fit as well in a desktop context.

You can control whether or not your app displays a back button in its window by setting a preference inside the <application> tag:

<meta-data android:name="WindowManagerPreference:SuppressWindowControlNavigationButton" android:value="[true|false]" />

Resolve issues with camera preview images

Camera problems can arise when the app can only run in portrait orientation but the user runs it on a landscape screen. In this case, the preview, or the captured result, could be incorrectly rotated.

Compatibility mode changes how the system handles events, such as orientation changes, in Chrome OS. This helps to prevent issues when the camera is used in the wrong orientation mode. To enable compatibility mode:

Handling device settings

Changing volume

Chrome OS devices are fixed volume devices. Apps that play sound should have their own volume controls. Follow the guidelines for Working with fixed volume devices.

Changing screen brightness

You cannot adjust device brightness on Chrome OS. Calls to the system settings and WindowManager.LayoutParams are ignored.

Additional learning materials

To learn more about optimizing your Android apps for Chromebooks, consult the following resources:

Situs ini menggunakan cookies untuk menyimpan preferensi Anda tentang bahasa di situs tertentu dan opsi tampilan.

Dapatkan berita dan tips terbaru dari developer Android yang akan membantu Anda mencapai kesuksesan di Google Play.

* Wajib Diisi


Ikuti Google Developers di WeChat

Buka situs ini dalam bahasa ?

Anda meminta halaman dalam bahasa , namun preferensi bahasa untuk situs ini adalah .

Ingin mengubah preferensi bahasa dan mengakses situs ini dalam bahasa ? Jika nanti Anda ingin mengubah preferensi bahasa, gunakan menu bahasa di bagian bawah setiap halaman.

Kelas ini memerlukan tingkat API atau yang lebih tinggi

Dokumen ini tersembunyi karena level API yang Anda pilih untuk dokumentasi ini adalah . Anda dapat mengubah level API dokumentasi dengan pemilih di atas menu navigasi sebelah kiri.

Untuk informasi lebih lanjut tentang menentukan level API yang diperlukan aplikasi Anda, baca Mendukung Versi Platform Yang Berbeda.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)