天天看點

AI開發實戰2-定制自己的AI伴侶2 App Inventor2 Companion的定制

2 App Inventor2 Companion的定制

    用ant指令編譯App Inventor的源碼後,在appinventor/build/buildserver檔案夾裡會生成AI伴侶APP:MIT AI2 Companion.apk

    AI伴侶的源檔案在appinventor的aiplayapp檔案夾中,包含了以下幾個檔案夾:

    assets——包含了App Inventor2 Companion使用的圖檔:

    從中也可看出在AI伴侶界面上顯示的一些文字都是在圖檔上的。

    Src——包含了AI伴侶的代碼檔案,共有三個:

    在Screen1.yail檔案中,包含了AI伴侶界面顯示的字元串,如下:

(set-and-coerce-property! 'Screen1 'Title"MIT App Inventor 2 Companion" 'text)

(set-and-coerce-property! 'CodeBox 'Hint"Six Character Code" 'text)

(set-and-coerce-property! 'Label4 'Text"Your IP Address is: " 'text)

(set-and-coerce-property! 'Label11 'Text"Version: " 'text)

    Youngandroidproject——包含了一個工程屬性檔案project.properties,内容如下:

    name——AI伴侶APK的名稱

    Icon——APK使用的icon圖檔

    Versionname——APK的版本号

    對上述内容進行修改,就可以定制一個屬于自己的AI伴侶APP。

    如要修改AI伴侶的功能菜單,則需要修改Screen的源碼。