• Android 學習之旅!(2)


    早幾天因爲學車,弄了幾天時間和精力過去,今天終於考過了(科目二,還是補考的...)嗯..不管這麼多了..今天又開始我的android 學習之旅!!

    筆記:

    platform-tools目錄下的文件:

    adb.exe : android debug bridge(android調試橋)

      devices 列出所有連接設備

      kill-server 殺掉 adb

      start-server 啓動 adb

    dx.bat : 打包生成dex文件

    tools目錄下的文件:

    emulator.exe : 模擬器

    項目文件目錄下:

    .setting  保存配置信息(eclipse)

    assets  資產目錄(存放文件,會打包到APK.例:圖片,數據庫...

    bin  編譯後的文件目錄

    gen  (Generated Java File)(自動生成的文件目錄)

      BuildConfig.java  適配信息

      R.java  存放資源id的引用

    Android x.x.x  (x.x.x版本號)

      android.jar(SDK)好吧,前面說的"夾包"是jar包...終於懂了..

    project.properties  編譯版本

      target=android-x  (x版本號)

    libs  支持的jar,會被添加到android depend目錄下

      android-support-v4.jar  (補錄API)

    res  資源目錄

      drawable-xxxx(hdpi,ldpi,mdpi,xhdpi,xxhdpi...)  存放應用程序圖標  會自動生成id到R.java文件

      layout

        activity_main.xml  (MVC中的View)   

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
    <TextView 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@string/hello_world" />
    </RelativeLayout>
    View Code

           RelativeLayout(相對佈局)

          xmlns(命名空間)

          Layout_width,Layout_height(控件的寬高)  match_parent(填充)

          wrap_content(包裹內容)

          centerHorizontal(水平居中)

          centerVertical(垂直居中)

          @(代表res,res又會編譯成R.java)  string(內部類)會在  res/values*/strings.xml 中有對應定義的字符串

      AndroidMainfest.xml  (當前應用程序的清單文件,程序的配置信息={"啓動圖標","應用程序名稱","包名","版本號","..."})

    <?xml version="1.0" encode="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.itheima.helloworld"
    android:versionCode="1"
    android:versionName="1.0" >
    
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@strings/app_name"
        android:theme="@style/AppTheme" >
    <activity
        android:name="com.itheima.helloworld.MainActivity"
        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>
    View Code

        package="com.itheima.helloworld"  (手機應用依靠包名標識)

        android:versionCode="1",android:versionName="1.0"  (應用版本號)

        android:minSdkVersion="8"  (系統要求最低版本)  android:targetSdkVersion="17"  (系統最高版本?)

        android:icon="@drawable/ic_launcher"  (圖標)

        android:label="@string/app_name"  (應用程序名稱)

        android:theme="@style/AppTheme"  (應用程序樣式)

        <activity>應用程序界面  

        (在桌面生成圖標...)<intent-filter>額外的配置<action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" />

        這裏我自己百度了一..

    第一种情况:有MAIN,无LAUNCHER,程序列表中无图标
    原因:android.intent.category.LAUNCHER决定应用程序是否显示在程序列表里 
    第二种情况:无MAIN,有LAUNCHER,程序列表中无图标
    原因:android.intent.action.MAIN决定应用程序最先启动的Activity,如果没有Main,则不知启动哪个Activity,故也不会有图标出现

      今天就這樣先吧..好多關鍵字都不懂啊..有點吃力

  • 相关阅读:
    计算机二进制总结
    java-集合排序,队列,散列表map以及如何遍历
    java-Collection,List简单使用与方法/(集合使用-中)
    java-Date类与集合(上)
    java-正则、object中的两个方法的使用
    java-注释、API之字符串(String)
    Java-面向对象三大特征、设计规则
    java-多态、内部类
    java-修饰词、抽象类、抽象方法
    java-重载、包修饰词以及堆栈管理
  • 原文地址:https://www.cnblogs.com/kazehanaai/p/4513219.html
Copyright © 2020-2023  润新知