Android 4.0 UI for tablet and handset

Source: Internet
Author: User

Android 4.0 (ICS) Merge handset and tablet UI together, make customer flexible to use which UI they want. on Marketing nowdays, phone use Phone mode directly and other product like tablet/Mid/PND use tablet mode.

ICS support multi-panel in tablet mode to fully use advantage of large screen size which is the major difference with former Android version.

Following layout gives us a brief knowledge about ics ui:

+ ------------------------------------------------- +
| System bar (only in phone UI) |
+ ------------------------------------------------- +
| (Layout with background drawable) |
| + --------------------------------------------- + |
|
Title/action? Bar (optional) |
| + --------------------------------------------- + |
| Content, vertical extending |
|
| + --------------------------------------------- + |
+ ------------------------------------------------- +
| System bar (only in tablet UI) |
+ ------------------------------------------------- +

Config_statusbarcomponent choose which resource we want, statusbar or systembar. If phone, use Com. Android. systemui. statusbar. Phone. phonestatusbar ?; While
Tablet, use Com. Android. systemui. statusbar. tablet. tabletstatusbar ?. Frameworks/base/packages/systemui/src/COM/Android/systemui/systemuiservice. Java

    public void onCreate() {        // Pick status bar or system bar.        IWindowManager wm = IWindowManager.Stub.asInterface(                ServiceManager.getService(Context.WINDOW_SERVICE));        try {            SERVICES[0] = wm.canStatusBarHide()                    ? R.string.config_statusBarComponent                    : R.string.config_systemBarComponent;        } catch (RemoteException e) {            Slog.w(TAG, "Failing checking whether status bar can hide", e);        }

Res/values/config. xml

<string name="config_statusBarComponent" translatable="false">             com.android.systemui.statusbar.phone.PhoneStatusBar</string><string name="config_systemBarComponent" translatable="false">             com.android.systemui.statusbar.tablet.TabletStatusBar<string> 

Canstatusbarhide defined inframeworks/base/policy/src/COM/Android/Internal/policy/impl/phonewindowmanager. Java

    public boolean canStatusBarHide() {        return mStatusBarCanHide;    }

Mstatusbarcanhide true or false determine status bar or system bar.

        int shortSizeDp = shortSize                * DisplayMetrics.DENSITY_DEFAULT                / DisplayMetrics.DENSITY_DEVICE;        mStatusBarCanHide = shortSizeDp < 600;        mStatusBarHeight = mContext.getResources().getDimensionPixelSize(                mStatusBarCanHide                ? com.android.internal.R.dimen.status_bar_height                : com.android.internal.R.dimen.system_bar_height);

Here if your sizedp smaller than 600, then system use as tablet mode, otherwise Phone mode. density_default is fixed 160. therefore, 800*480 resolution which compute as 480*160/density_device and 800*600 compute as 600*160/density_device. so 120 shocould be
Suitable value to make both needs the tablet condition.

setprop ro.sf.lcd_density 120

Frameworks/base/CORE/Java/Android/content/RES/configuration. Java System Configuration

public static final int SCREENLAYOUT_SIZE_SMALL = 0x01; public static final int SCREENLAYOUT_SIZE_NORMAL = 0x02; public static final int SCREENLAYOUT_SIZE_LARGE = 0x03; public static final int SCREENLAYOUT_SIZE_XLARGE = 0x04;

ICS also has three common software virtual key back, home and recent, default tablet mode appear while Phone mode shocould modify code to adapt these keys. framework/base/packages/systemui/RES/layout/navigation_bar.xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.