Adaptive to the device and user Device Compatibility , language configuration comments

===============================  硬件feature

2。 运行时检测设备配置,动态disable不支持的feature

2。1  在manifest中描述要使用的feature,让平台来判断

<uses-feature android:name="android.hardware.sensor.compass"
                  android:required="true" />

2。2 自己判断

1。 设备feature描述

.FEATURE_XXX
2。检测
PackageManager.hasSystemFeature(。。)

public abstract FeatureInfo[] getSystemAvailableFeatures ()
public abstract boolean hasSystemFeature (String name)

Hardware features

The table below describes the hardware feature descriptors supported by themost current platform release. To signal that your application uses or requiresa hardware feature, declare each value in a android:name attributein a separate <uses-feature> element.

Feature TypeFeature DescriptorDescriptionComments
Audio   android.hardware.audio.low_latencyThe application uses a low-latency audio pipeline on the device andis sensitive to delays or lag in sound input or output. 
Bluetoothandroid.hardware.bluetoothThe application uses Bluetooth radio features in the device. 
android.hardware.bluetooth_leThe application uses Bluetooth Low Energy radio features in the device. 
Cameraandroid.hardware.cameraThe application uses the device's camera. If the device supports multiple cameras, the application uses the camera that facing away from the screen. 
android.hardware.camera.autofocusSubfeature. The application uses the device camera's autofocus capability.These subfeatures implicitly declare theandroid.hardware.camera parent feature, unless declared withandroid:required="false".
android.hardware.camera.flashSubfeature. The application uses the device camera's flash.
android.hardware.camera.frontSubfeature. The application uses a front-facing camera on the device.
android.hardware.camera.anyThe application uses at least one camera facing in any direction, or anexternal camera device if one is connected. Use this in preference toandroid.hardware.camera if a back-facing camera is not required.
android.hardware.camera.externalThe application uses an external camera device if one is connected.
android.hardware.camera.
level.full
The application uses a camera device with FULL-level support.
android.hardware.camera.
capability.manual_sensor
The application uses a a camera device with the MANUAL_SENSOR capability.
android.hardware.camera.
capability
.manual_post_processing
The application uses a a camera device with the MANUAL_POST_PROCESSING capability.
android.hardware.camera
.capability.raw
The application uses a a camera device with the RAW capability.
Infraredandroid.hardware.consumerirThe application uses the consumer IR capabilities on the device. 
Locationandroid.hardware.locationThe application uses one or more features on the device for determininglocation, such as GPS location, network location, or cell location. 
android.hardware.location.networkSubfeature. The application uses coarse location coordinates obtained froma network-based geolocation system supported on the device.These subfeatures implicitly declare theandroid.hardware.location parent feature, unless declared withandroid:required="false".
android.hardware.location.gpsSubfeature. The application uses precise location coordinates obtainedfrom a Global Positioning System receiver on the device.
Microphoneandroid.hardware.microphoneThe application uses a microphone on the device. 
NFCandroid.hardware.nfcThe application uses Near Field Communications radio features in the device. 
android.hardware.nfc.hceThe application uses the NFC card emulation feature in the device. 
Sensorsandroid.hardware.sensor.accelerometerThe application uses motion readings from an accelerometer on thedevice. 
android.hardware.sensor.barometerThe application uses the device's barometer. 
android.hardware.sensor.compassThe application uses directional readings from a magnetometer (compass) onthe device. 
android.hardware.sensor.gyroscopeThe application uses the device's gyroscope sensor. 
android.hardware.sensor.lightThe application uses the device's light sensor. 
android.hardware.sensor.proximityThe application uses the device's proximity sensor. 
android.hardware.sensor.stepcounterThe application uses the device's step counter. 
android.hardware.sensor.stepdetectorThe application uses the device's step detector. 
Screenandroid.hardware.screen.landscapeThe application requires landscape orientation.

For example, if your app requires portrait orientation, you should declare<uses-feature android:name="android.hardware.screen.portrait"/> so that only devicesthat support portrait orientation (whether always or by user choice) can install your app. If yourapplication supports both orientations, then you don't need to declare either.

Both orientations are assumed not required, by default, so your app may be installedon devices that support one or both orientations. However, if any of your activities request thatthey run in a specific orientation, using the android:screenOrientation attribute, then this also declares that the application requires thatorientation. For example, if you declare android:screenOrientation with either "landscape", "reverseLandscape", or"sensorLandscape", then your application will be available only to devices that supportlandscape orientation. As a best practice, you should still declare your requirement for thisorientation using a <uses-feature> element. If you declare an orientation for youractivity using android:screenOrientation, but don't actually require it, you can disable therequirement by declaring the orientation with a <uses-feature> element and includeandroid:required="false".

For backwards compatibility, any device running a platform version that supports only APIlevel 12 or lower is assumed to support both landscape and portrait.

android.hardware.screen.portraitThe application requires portrait orientation.
Telephonyandroid.hardware.telephonyThe application uses telephony features on the device, such as telephonyradio with data communication services. 
android.hardware.telephony.cdmaSubfeature. The application uses CDMA telephony radio features on thedevice.These subfeatures implicitly declare theandroid.hardware.telephony parent feature, unless declared withandroid:required="false".
android.hardware.telephony.gsmSubfeature. The application uses GSM telephony radio features on thedevice.
Televisionandroid.hardware.type.televisionThe application is designed for a television user experience.This feature defines "television" to be a typical living room television experience: displayed on a big screen, where the user is sitting far away and the dominant form of input is something like a d-pad, and generally not through touch or a mouse/pointer-device.
Touchscreenandroid.hardware.faketouchThe application uses basic touch interaction events, such as "click down", "clickup", and drag.

When declared as required, this indicates that the application is compatible with a deviceonly if it offers an emulated touchscreen ("fake touch" interface), or better. A device that offersa fake touch interface provides a user input system that emulates a subset of touchscreencapabilities. For example, a mouse or remote control that drives an on-screen cursor provides a faketouch interface. If your application requires basic point and click interaction (in otherwords, it won't work with only a d-pad controller), you should declare this feature.Because this is the minimum level of touch interaction, your app will also be compatible withdevices that offer more complex touch interfaces.

Note: Because applications require the android.hardware.touchscreen feature by default, if you want your application to be available todevices that provide a fake touch interface, you must also explicitly declare that a touch screen isnot required by declaring <uses-featureandroid:name="android.hardware.touchscreen" android:required="false"/>

android.hardware.faketouch.
multitouch.distinct
The application performs distinct tracking of two or more "fingers" on a fake touchinterface. This is a superset of the faketouch feature.

When declared as required, this indicates that the application is compatible with a deviceonly if it supports touch emulation for events that supports distinct tracking of two or morefingers, or better.

Unlike the distinct multitouch defined by android.hardware.touchscreen.multitouch.distinct, input devices that support distinct multi-touchwith a fake touch interface will not support all two-finger gestures, because the input isbeing transformed to cursor movement on the screen. That is, single finger gestures on such a devicemove a cursor; two-finger swipes will result in single-finger touch events; other two-fingergestures will result in the corresponding two-finger touch event. An example device that supportsdistinct multi-touch with a fake touch interface is one that provides a trackpad for cursor movementwhich also supports two or more fingers.

android.hardware.faketouch.
multitouch.jazzhand
The application performs distinct tracking of five or more "fingers" on a fake touchinterface. This is a superset of the faketouch feature.

When declared as required, this indicates that the application is compatible with a deviceonly if it supports touch emulation for events that supports distinct tracking of five or morefingers.

Unlike the distinct multitouch defined by android.hardware.touchscreen.multitouch.jazzhand, input devices that support jazzhand multi-touchwith a fake touch interface will not support all five-finger gestures, because the input is beingtransformed to cursor movement on the screen. That is, single finger gestures on such a device movea cursor; multi-finger gestures will result in single-finger touch events; other multi-fingergestures will result in the corresponding multi-finger touch event. An example device that supportsdistinct multi-touch with a fake touch interface is one that provides a trackpad for cursor movementwhich also supports five or more fingers.

android.hardware.touchscreenThe application uses touchscreen capabilities for gestures that are more interactivethan basic touch events, such as a fling. This is a superset of the basic faketouch feature.

By default, your application requires this. As such, your application is notavailable to devices that provide only an emulated touch interface ("fake touch"), by default. Ifyou want your application available to devices that provide a fake touch interface (or even devicesthat provide only a d-pad controller), you must explicitly declare that a touch screen is notrequired, by declaring android.hardware.touchscreen with android:required="false".You should do so even if your application uses—but does not require—a realtouch screen interface.

If your application does require a touch interface (in order to perform touchgestures such as a fling), then you don't need to do anything, because this is required by default.However, it's best if you explicitly declare all features used by your application, so you shouldstill declare this if your app uses it.

If you require more complex touch interaction, such as multi-finger gestures, youshould declare the advanced touch screen features below.

android.hardware.touchscreen.multitouchThe application uses basic two-point multitouch capabilities on the devicescreen, such as for pinch gestures, but does not need to track touches independently. Thisis a superset of touchscreen feature.This implicitly declares the android.hardware.touchscreen parent feature, unlessdeclared with android:required="false".
android.hardware.touchscreen
.multitouch.distinct
Subfeature. The application uses advanced multipoint multitouchcapabilities on the device screen, such as for tracking two or more points fullyindependently. This is a superset of multitouch feature.This implicitly declares the android.hardware.touchscreen.multitouchparent feature, unless declared with android:required="false".
android.hardware.touchscreen.
multitouch.jazzhand
The application uses advanced multipoint multitouchcapabilities on the device screen, for tracking up to five points fullyindependently. This is a superset of distinct multitouch feature.
USBandroid.hardware.usb.hostThe application uses USB host mode features (behaves as the host and connects to USBdevices). 
android.hardware.usb.accessoryThe application uses USB accessory features (behaves as the USB device and connects to USBhosts). 
Wi-Fiandroid.hardware.wifiThe application uses 802.11 networking (Wi-Fi) features on the device. 
android.hardware.wifi.directThe application uses the Wi-Fi Direct networking features on the device.

Software features

The table below describes the software feature descriptors supported by themost current platform release. To signal that your application uses or requiresa software feature, declare each value in a android:name attributein a separate <uses-feature> element.

FeatureAttribute ValueDescription
App Widgetsandroid.software.app_widgetsThe application uses or provides App Widgets and should be installed only on devices that include a Home screen or similar location where users can embed App Widgets.
Device Managementandroid.software.device_adminThe application uses device policy enforcement via device administrators.
Home Screenandroid.software.home_screenThe application behaves as a Home screen replacement and should be installed only on devices that support third-party Home screen apps.
Input Methodandroid.software.input_methodsThe application provides a custom input method and should be installed only on devices that support third-party input methods.
Live Wallpaperandroid.software.live_wallpaperThe application uses or provides Live Wallpapers and should be installed only on devices that support Live Wallpapers.
SIP/VOIPandroid.software.sipThe application uses SIP service on the device and should be installed only on devices that support SIP.
android.software.sip.voip

Subfeature. The application uses SIP-based VOIP service on the device.

This subfeature implicitly declares the android.software.sip parent feature,unless declared with android:required="false".


============================== 软件sdk version

1.  平台判断,提供我的需求

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />

2. 自己判断

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
    // Running on something older than API level 11, so disable
    // the drag/drop features that use ClipboardManager APIs
    disableDragAndDrop();
}


=============================== Screen configuration

4 size type:small, normal, large, and xlarge ,( landscape or portrait) is considered a variation ofscreen size

4 density type :mdpi (medium), hdpi (hdpi), xhdpi (extra high), xxhdpi (extra-extra high), and others


MyProject/
    res/
        layout/              # default (portrait)
            main.xml
        layout-land/         # landscape
            main.xml
        layout-large/        # large (portrait)
            main.xml
        layout-large-land/   # large landscape
            main.xml


  • xhdpi: 2.0
  • hdpi: 1.5
  • mdpi: 1.0 (baseline)
  • ldpi: 0.75

This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.

Then, place the files in the appropriate drawable resource directory:

MyProject/
    res/
        drawable-xhdpi/
            awesomeimage.png
        drawable-hdpi/
            awesomeimage.png
        drawable-mdpi/
            awesomeimage.png
        drawable-ldpi/
            awesomeimage.png
============================= language

MyProject/
    res/
       values/
           strings.xml
       values-es/
           strings.xml
       values-fr/
           strings.xml

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值