• 2、android系统框架的介绍


      android系统框架介绍

      src目录:主要完成java代码编写

      assets目录:资源目录

      res目录:存放图片、布局文件、字符串、菜单等文件

      bin目录:输出文件夹,如生成apk文件

      project.properties:工程属性文件配置

      gen目录:系统自动生成的源代码目录

      R.java文件:系统自动生成的文件,默认有attr、drawable、layout、string4个静态内部类,每个类对应一种资源

      AndroidManifest.xml:描述package中暴露的组件(activities,service等),他们各自的实现类,各种能被处理的数据和启动位置,除了能声明程序中的Activies、ContentProviders、Service、Intent Receives,还能指定permission和instrumentation(安全控制和测试)

      res资源文件下包含:

        drawable文件:存放工程图片信息,默认png格式

        layout文件:存放工程布局文件,.xml文件格式

        values文件:                    取值方式       

          string.xml存放自定义的字符串和数值(很重要)   getResource().getString(id)或者getResource().getText(id)

          array.xml存放数组               getResource().getStringArray(id)

          color.xml存放颜色字符串数值           getResource().getDrawable(id)或者getResource().getColor(id)

          dimens.xml存放尺寸数值            getResource().getDimension(id)

          styles.xml定义样式               不需要取值

      

      AndroidManifest.xml主要语法定义:

        

    <?xml version="1.0" encoding="utf-8"?>
    <!-- package="com.jc.helloworld"指定java应用程序的主要包名
    android:versionCode="1"该工程的主要版本号
    android:versionName="1.0"版本的一个名称
    android:installLocation="auto"应用安装地方 auto自动选择 internalOnly安装到ORM preferExternal安装到SD卡-->
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jc.helloworld"
    android:versionCode="1"
    android:versionName="1.0"
    android:installLocation="auto" >

    <!-- android:minSdkVersion="8" 指定sdk最低适配版本
    android:targetSdkVersion="18" 指定sdk标准版本-->
    <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="18" />

    <!-- android:allowBackup="true"
    android:icon="@drawable/ic_launcher" 指定应用的loge图片
    android:label="@string/app_name" 应用工程的文字说明
    android:theme="@style/AppTheme" 应用的主体风格-->
    <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <!-- android:name="com.jc.helloworld.HelloActivity" 指定应用程序的主程序名称
    android:label="@string/app_name"
    <intent-filter> 意图过滤器 过滤一些动作和操作
    android.intent.action.MAIN 表示当前程序是工程入口程序
    android.intent.category.LAUNCHER 表示决定应用程序是否在程序列表中显示-->
    <activity
    android:name="com.jc.helloworld.HelloActivity"
    android:label="@string/app_name" >
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    </application>

    </manifest>

          

  • 相关阅读:
    Android应用中使用自定义文字
    Linux下diff使用简介
    Android扫描SD卡中的文件
    onActivityResult不起作用?可能是和你的launchMode有关!
    修改SlidingMenu,使其能够完美运行
    eclipse快捷键说明
    XP下Virtualbox虚拟Ubuntu共享文件夹设置
    记一次调用RefreshObjectCaches刷新节点上的文件内容
    idea快捷键之遍历
    word转pdf
  • 原文地址:https://www.cnblogs.com/RocketMan/p/5325494.html
Copyright © 2020-2023  润新知