第二周筆記

活動(dòng)

Eclipse的代碼助手與快速補(bǔ)全(alt+/)

助手windows—preferense—Java—editor—content—倒數(shù)第二行把26個(gè)字母補(bǔ)全(不刪.)。

步驟1:(1)activity(一個(gè)頁(yè)面)

(2)layout(頁(yè)面布局)

(3)res(頁(yè)面內(nèi)的資源(drawable))

注:按照上次課建新project(但不自動(dòng)生成圖標(biāo)與activity)。

確定版本android:versionName="1.0.0"

改圖標(biāo)android:icon="@drawable/logo"

復(fù)制包名com.example.dongzhen

繼承父類android.app.Activity

調(diào)用onCreate

Layout下創(chuàng)建Android xml file(名稱不允許大寫)。

設(shè)置背景android:background="@drawable/lbg">

注冊(cè)包,否則安裝后會(huì)有沒(méi)注冊(cè)警告

<activity

? ? ? ? ? ?android:name=".dongzhen1"

? ? ? ? ? ?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>


創(chuàng)建命令按鈕

<Button

? ? android:layout_width="wrap_content"

? ? android:layout_height="wrap_content"

? ? android:text="切換到下一頁(yè)" ?

? ? ? ?></Button>

控件注冊(cè)android:id="@+id/button"

綁定控件Button并強(qiáng)制轉(zhuǎn)換button=(Button) findViewById(R.id.button);

建立第二頁(yè)(方法同上)

對(duì)按鈕寫監(jiān)聽頁(yè)面跳轉(zhuǎn)

button.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View arg0) {

// TODO Auto-generated method stub

}

});

通過(guò)intent進(jìn)行跳轉(zhuǎn)

Intent intent=new Intent(dongzhen1.this,dongzhen2.class);

startActivity(intent);

步驟2:裝飾

步驟3:交互(按鈕等)

步驟4:(1)線性布局 (2)相對(duì)布局

步驟5:(1)簽名 ?(2)打包 ?(3)發(fā)布

總結(jié):版本號(hào)、版本名稱的修改

應(yīng)用名、圖標(biāo)的修改

聲明首頁(yè)

布局

圖片發(fā)自簡(jiǎn)書App

圖片發(fā)自簡(jiǎn)書App
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容