zoukankan      html  css  js  c++  java
  • Android 4学习(2):概述

    Android应用程序包含下面这几个部分:

    程序的前后台:

    • Activities
    • Services
    存储:
    • Content Providers
    消息传递:
    • Intents
    • Broadcast Receivers
    手机特性:
    • Widgets
    • Notifications

    每个Android程序运行在单独的Dalvik虚拟机上,并且每个Android运行在不同的用户空间中,也就说,不同的android程序在linux中的用户空间是不同的。这样,android消息传递使用broadcast的方式应该就容易理解了。

    Android Manifest

    有过Web开发经验的程序员也许会对AndroidManifest.xml文件感到亲切,它很像web.xml,包含android程序中的方方面面。学造房子的时候,我们最好先学会看设计图。每一个android程序都有自己的AndroidManifest.xml,它主要包含:
    • android应用的结构信息
      • Activity,Service,Content Provider,Broadcast Receiver
      • Intent Filter
    • 元数据。
      • 版本号,图标,主题等

    AndroidManifest.xml中的标签

    • uses-sdk:顾名思义
      • <uses-sdk android:minSdkVersion=”6” android:targetSdkVersion=”15”/>
    • uses-configuration:硬件的配置信息
      • <uses-configuration android:reqTouchScreen=”finger” android:reqNavigation=”trackball” android:reqHardKeyboard=”true” android:reqKeyboardType=”twelvekey”/>
    • uses-feature:程序运行所需要的硬件支持
    • supports-screens:顾名思义
      • <supports-screens android:smallScreens=”false”
        android:normalScreens=”true”
        android:largeScreens=”true”
        android:xlargeScreens=”true”
        android:requiresSmallestWidthDp=”480”
        android:compatibleWidthLimitDp=”600”
        android:largestWidthLimitDp=”720”/>
    • supports-gl-texture:声明这个应用程序是否能提供由一种GL压缩格式的asset
      • <supports-gl-texture android:name=”GL_OES_compressed_ETC1_RGB8_texture” />
    • uses-permission
      • <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION”/>
    • permission:用户自定义的permission
      • <permission android:name=”com.paad.DETONATE_DEVICE”
        android:protectionLevel=”dangerous”
        android:label=”Self Destruct”
        android:description=”@string/detonate_description”>
        </permission>
    • instrumentation:测试相关
      • <instrumentation android:label=”My Test”
        android:name=”.MyTestClass”
        android:targetPackage=”com.paad.apackage”>
        </instrumentation>
    • application:一个manifest文件中只能有一个application标签
      • <application android:icon=”@drawable/icon”
        android:logo=”@drawable/logo”
        android:theme=”@android:style/Theme.Light”
        android:name=”.MyApplicationClass”
        android:debuggable=”true”>
        [ ... application nodes ... ]
        </application>
      • 子标签:activity
        • <activity android:name=”.MyActivity” android:label=”@string/app_name”>
          <intent-filter>
          <action android:name=”android.intent.action.MAIN” />
          <category android:name=»android.intent.category.LAUNCHER» />
          </intent-filter>
          </activity>
      • 子标签:service
        • <service android:name=”.MyService”></service>
      • 子标签:provider
        • <provider android:name=”.MyContentProvider” android:authorities=”com.paad.myapp.MyContentProvider”/>
      • 子标签:receiver
        • <receiver android:name=”.MyIntentReceiver”>
          <intent-filter>
          <action android:name=”com.paad.mybroadcastaction” />
          </intent-filter>
          </receiver>
      • 子标签:uses-library
        • <uses-library android:name=”com.google.android.maps” android:required=”false”/>
  • 相关阅读:
    <input type='date'>传到后台怎么接收
    @Conditionnal注解和拦截器
    docker安装nginx
    vue npm run build报错 npm ERR! missing script: build
    阳哥讲面试题(七)Redis五种基本类型,分布式锁
    阳哥讲面试题(六)AOP,循环依赖
    mysql建表报错(this is incompatible with sql_mode=only_full_group_by)
    阳哥讲面试题(五)各种锁,LockSupport,AQS
    SSM_CRUD新手练习(2)配置文件
    Mysql逻辑分层、存储引擎
  • 原文地址:https://www.cnblogs.com/jubincn/p/3381085.html
Copyright © 2011-2022 走看看