[基础知识]全面认识AndroidManifest.xml文件(二)
自定义权限结构如下:
android:description
必须为字符串资源,不能为raw资源,给用户看的详细的权限解释说明文档
android:icon
一个可以描绘权限的drawable资源
android:label
开发的时候为了方便可以使用原生字符串,但程序发行时应该使用字符串资源,以便本地化
android:name
权限名字,必须唯一,遵循Java代码规范 应该类似于“com.example.project.PERMITTED_ACTION”
android:permissionGroup
将自定义权限放入一个组中,不设置,则不属于任何权限组
android:protectionLevel
normal
默认设置,系统在应用安装时自动授予此权限,对其他应用、用户与系统风险很小
dangerous
高风险权限,由于存在潜在风险,系统不会自动授予,需要用户确认
signature
当请求程序所用的许可签名与程序声明的一致,系统才会不通知用户并自动授予此权限
signatureOrSystem
授予权限给系统中相同许可签名的应用,避免使用此选项
用于声明权限树根节点的名称,放置权限的命名空间
通过PackageManager.addPermission()添加权限
android:icon
描述树中所有权限的图标,必须是drawable资源
android:label
容易理解的组名标签,为了便利,可以直接使用原生字符串,但发行时应使用字符串资源,以便本地化
android:name
权限树根节点名称,用于包中所有权限前缀,Java命名风格,最少两个句点,com.example.base可以,com.example不行
给权限的一个逻辑分组
Android官方在定义权限时,大部分权限都有permission-group属性,没有的也应以label与description标签清楚说明
https://github.com/android/platform_frameworks_base/blob/master/core/res/AndroidManifest.xml
声明一个Instrumentation类来监视系统与应用的交互,Instrumentation对象会在其他应用组件前实例化
android:functionalTest
是否以功能测试模式来运行,默认为false,不以此模式运行
android:handleProfiling
是否开启性能分析功能,默认为false,整个运行时间都开启,true表示可以自由决定开关,以针对特定操作进行分析
android:icon
android:label
android:name
全限定类名,比如com.example.project.StringInstrumentation 如果以句点开头,
android:targetPackage
指定Instrumentation对象监视的应用在
指定应用兼容的平台版本
android:minSdkVersion
指定兼容的最低版本 默认为1
android:targetSdkVersion
指定运行的目标平台版本,应该跟随最新API级别。如果运行时平台版本大于targetSdkVersion,系统将启用兼容模式
android:maxSdkVersion
指定最高平台版本,如果平台版本大于maxSdkVersion,应用将不被显示,像被移除一样。不推荐声明此属性,新平台设计时就应该是向下兼容的。
指定应用所需的硬件与软件功能,避免在不支持的平台上工作
android:regFiveWayNav
是否需要五向导航功能(上、下、左、右、选择对象),比如D-pad方向板、轨迹球等
android:reqHardKeyboard
是否需要物理键盘
android:reqKeyboardType
不分物理键盘/虚拟键盘
undefined未定义,默认不需要 nokeys明确不需要qwerty需要标准qwerty键盘twelvekey像拨号界面那种0-9 * #的12键键盘
android:reqNavigation
undefined未定义,默认不需要 nonav明确不需要dpad需要D-pad方向板trackball需要轨迹球wheel需要导航滚轮
android:reqTouchScreen
undefined未定义,默认不需要notouch明确不需要stylus需要触控笔finger能够手指触摸操作
AndroidMarket可以根据
android:name
支持的硬件与软件名称属性
Audio:android.hardware.audio.low_latency
Bluetooth:android.hardware.bluetooth,android.hardware.bluetooth_le
Camera:android.hardware.camera,android.hardware.camera.autofocus,android.hardware.camera.flash,android.hardware.camera.front,android.hardware.camera.any,
android.hardware.camera.external
Infrared:android.hardware.consumerir
Location:android.hardware.location,android.hardware.location.network,android.hardware.location.gps
Microphone:android.hardware.microphone
NFC:android.hardware.nfc,android.hardware.nfc.hce
Sensors:android.hardware.sensor.accelerometer,android.hardware.sensor.barometer,android.hardware.sensor.compass,android.hardware.sensor.gyroscope,android.hardware.sensor.light,android.hardware.sensor.proximity,android.hardware.sensor.stepcounter,android.hardware.sensor.stepdetector
Screen:android.hardware.screen.landscape,android.hardware.screen.portrait
Telephony:android.hardware.telephony,android.hardware.telephony.cdma,android.hardware.telephony.gsm
Television:android.hardware.type.television
Touchscreen:android.hardware.faketouch,android.hardware.faketouch.multitouch.distinct,android.hardware.faketouch.multitouch.jazzhand,android.hardware.touchscreen,android.hardware.touchscreen.multitouch,android.hardware.touchscreen.multitouch.distinct,android.hardware.touchscreen.multitouch.jazzhand
USB:android.hardware.usb.host,android.hardware.usb.accessory
Wi-Fi:android.hardware.wifi,android.hardware.wifi.direct
AppWidgets:android.software.app_widgets
DeviceManagement:android.software.device_admin
HomeScreen:android.software.home_screen
InputMethod:android.software.input_methods
LiveWallpaper:android.software.live_wallpaper
SIP/VOIP:android.software.sip,android.software.sip.voip
android:required
是否需要android:name属性指定的特性功能
android:glEsVersion
如果不声明此属性,默认为OpenGL ES 1.0,所有安卓设备都支持
用16位表示OpenGL ES版本
2.0为“0x00020000” 3.0为”0x00030000”
指定程序支持的屏幕尺寸,如果设备屏幕尺寸大于指定的,将启动屏幕兼容模式,在应用程序中使用这个元素指定支持的屏幕尺寸很重要
android:resizeable
这个属性已经被弃用了
android:smallScreens
是否支持较小外形的屏幕,默认true
android:normalScreens
是否支持普通大小屏幕,默认true
android:largeScreens
是否支持大屏,不同版本默认值不同,最好明确指定
android:xlargeScreens
比large还大,比如平板,不同版本默认值不同,最好明确指定
android:anyDensity
应用是否包含适用任何密度的资源,默认为true,除非需要直接操作位图,否则不应该设置为false
android:requiresSmallestWidthDp
指定支持的屏幕的最小尺寸
android:compatibleWidthLimitDp
指定程序最大的smallest screen width ,如果屏幕最小边大于这个值,默认将布局组件放大至全屏显示,但会提供一个屏幕兼容模式按钮让用户选择是否启动兼容模式
这个属性支持的最大值为320dp
android:largestWidthLimitDp
指定最大的smallest screen width,如果屏幕最小边小于这个值,将强制启动兼容模式,最大值为320dp
...
这个属性最好不要指定,如果没有在此处指定的屏幕尺寸,应用就不会在其面前显示,会显著减少用户群
指定程序支持的GL纹理压缩格式
GL_OES_compressed_ETC1_RGB8_texture:爱立信纹理压缩
GL_OES_compressed_paletted_texture:通用的调色板纹理压缩
GL_AMD_compressed_3DC_texture:ATI 3Dc纹理压缩
GL_AMD_compressed_ATC_texture:ATI纹理压缩
GL_EXT_texture_compression_latc:亮度的透明度纹理压缩
GL_EXT_texture_compression_dxt1:S3 DXT1纹理压缩
GL_EXT_texture_compression_s3tc:S3纹理压缩,不特定指DXT变种
GL_IMG_texture_compression_pvrtc:PowerVR纹理压缩
更多相关文章
- android之使用signapk打包成系统应用,获取系统权限
- [置顶] android四大组件之intent
- Android指定专用APN
- android Intent机制详解
- Intent机制详解
- TableLayout(表格布局)
- android intent使用方法
- Android(安卓)权限控制代码分析
- Android(安卓)初始化语言(Android(安卓)init Language翻译)