freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于googleandroid平臺(tái)上的軟件設(shè)計(jì)研究畢業(yè)論文(編輯修改稿)

2025-07-20 16:05 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 視操作,提取代碼圖25 建立AVD圖26 運(yùn)行結(jié)果:圖27圖28圖29圖30 掃雷游戲運(yùn)行分析游戲的目的是在沒(méi)有觸碰任何一個(gè)地雷的情形下清空一個(gè)雷區(qū)。掃雷不僅有Windows版本,也有其他平臺(tái)的版本(包括大多數(shù)Linux的變體)。掃雷在Windows的用戶中十分流行,自從Windows 。在掃雷游戲中,游戲者要面對(duì)一片磚塊組成的格柵,有些磚塊包含隨機(jī)設(shè)置的地雷。我們將實(shí)現(xiàn)一個(gè)典型的初學(xué)者級(jí)別掃雷游戲:行和列的數(shù)量都是9,一共有10顆地雷。擴(kuò)展成中級(jí)和高級(jí)游戲很容易(只需要改編代碼中的上述三個(gè)值)。在實(shí)現(xiàn)前我們需要了解這個(gè)游戲的一些特點(diǎn)(Windows版本):點(diǎn)擊左鍵打開(kāi)一個(gè)磚塊。點(diǎn)擊右鍵對(duì)磚塊進(jìn)行標(biāo)記:插旗幟(表示下面有雷),標(biāo)問(wèn)號(hào)(不確定是否有雷),取消標(biāo)記第一個(gè)磚塊下面永遠(yuǎn)沒(méi)有雷;避免了一開(kāi)始就要猜測(cè)的煩惱。如果打開(kāi)的磚塊是空的,周圍的磚塊都會(huì)依次打開(kāi)直到遇到數(shù)字磚塊。解釋和實(shí)現(xiàn)任何復(fù)雜系統(tǒng)的最好方法是一次一步進(jìn)行。首先探討布局和應(yīng)用的視覺(jué)及創(chuàng)建布局時(shí)用到的一些技術(shù)。然后討論鼠標(biāo)、點(diǎn)擊和觸摸事件的區(qū)別以及應(yīng)用的反應(yīng)。最后實(shí)現(xiàn)整個(gè)游戲以及上面介紹過(guò)的功能。我們將利用該較大難度的開(kāi)源程序進(jìn)行程序分析解析。圖31使用TableLayout進(jìn)行掃雷的布局,在TableLayout上加入三行: 第一行包括用于計(jì)時(shí)的三列數(shù)字,新游戲按鈕和剩余地雷數(shù)。我們使用TextView顯示計(jì)時(shí)和地雷數(shù)。新游戲按鈕使用ImageButton。第二行是50像素高的空的TextView,將第一行和雷區(qū)隔離開(kāi)。第三行是另一個(gè)TableLayout,用來(lái)顯示雷區(qū)。我們將動(dòng)態(tài)的向這個(gè)區(qū)域添加按鈕。圖32布局的代碼如下(刪去了一些額外的屬性來(lái)節(jié)省空間):?xmlversion=encoding=utf8?TableLayoutxmlns:android= android:stretchColumns=0,2 android:background=@drawable/back TableRow TextView android:id=@+id/Timer android:layout_column=0 android:text=000/ ImageButtonandroid:id=@+id/Smiley android:layout_column=1 android:background=@drawable/smiley_button_states android:layout_height=48px/ TextView android:id=@+id/MineCount android:layout_column=2 android:text=000/ /TableRow TableRow TextView android:layout_column=0 android:layout_height=50px android:layout_span=3 android:padding=10dip/ /TableRow TableRow TableLayoutxmlns:android= android:id=@+id/MineField android:layout_width=260px android:layout_height=260px android:gravity=bottom android:stretchColumns=* android:layout_span=3 android:padding=5dip /TableLayout /TableRow/TableLayout我們使用外部字體來(lái)顯示時(shí)間和地雷數(shù)。在Android中使用外部字體很容易,分為兩步: 在工程的assets文件夾下創(chuàng)建字體文件夾,復(fù)制TTF(True Type Font)文件至字體文件夾。通過(guò)調(diào)用createFromAsset 和傳遞TTF文件名創(chuàng)建一個(gè)Typeface對(duì)象。在這個(gè)對(duì)象中設(shè)置TextView的Typeface。代碼如下:private TextView txtMineCount。 private TextView txtTimer。 txtMineCount = (TextView) findViewById()。 txtTimer = (TextView) findViewById()。 // set font style for timer and mine count to LCD styleTypeface lcdFont = (getAssets(), fonts/)。 (lcdFont)。 (lcdFont)。 private TextView txtMineCount。private TextView txtTimer。txtMineCount = (TextView) findViewById()。txtTimer = (TextView) findViewById()。// set font style for timer and mine count to LCD styleTypeface lcdFont = (getAssets(), fonts/)。(lcdFont)。(lcdFont)在我們的掃雷游戲里,點(diǎn)擊新游戲的笑臉按鈕會(huì)讓這個(gè)笑臉變成緊張的表情。當(dāng)按鈕處于按壓狀態(tài)時(shí)(緊張的笑臉),我們需要一個(gè)不同的圖像。當(dāng)它處于正常狀態(tài)時(shí)需要另一張圖像。為了實(shí)現(xiàn)此功能,我們使用風(fēng)格,效果如下: 圖33使用風(fēng)格也需要兩步:創(chuàng)建一個(gè)XML文件(風(fēng)格定義文件),指定相應(yīng)的按鈕狀態(tài)使用的圖片。比如在按壓狀態(tài)下,我們需要驚訝(緊張)的圖片,正常狀態(tài)下需要微笑的圖片。當(dāng)然,這兩幅圖片已經(jīng)復(fù)制到 res/drawable文件夾中了。風(fēng)格文件的代碼如下:?xmlversion=encoding=utf8?selectorxmlns:android= itemandroid:state_focused=true android:state_pressed=false android:drawable=@drawable/smile/ itemandroid:state_focused=true android:state_pressed=true android:drawable=@drawable/surprise/ itemandroid:state_focused=false android:state_pressed=true android:drawable=@drawable/surprise/ itemandroid:drawable=@drawable/smile//selector?xml version= encoding=utf8?selector xmlns:android= item android:state_focused=true android:state_pressed=false android:drawable=@drawable/smile / item android:state_focused=true android:state_pressed=true android:drawable=@drawable/surprise / item android:state_focused=false android:state_pressed=true android:drawable=@drawable/surprise / item android:drawable=@drawable/smile //selector 為新游戲按鈕更新/添加背景的屬性值,將它的值設(shè)定為上面創(chuàng)建的風(fēng)格文件。更新后的ImageButton代碼如下:ImageButtonandroid:id=@+id/Smiley android:layout_column=1 android:background=@drawable/smiley_button_states android:layout_height=48px/ImageButton android:id=@+id/Smiley android:layout_column=1 android:background=@drawable/smiley_button_states android:layout_height=48px/TableLayout中的動(dòng)態(tài)行動(dòng)態(tài)添加磚塊的原理相同(磚塊是從按鈕類繼承的類,包含支持實(shí)現(xiàn)的額外功能)。我們希望它們像預(yù)想的那樣工作,分為如下的幾步: 創(chuàng)建一個(gè)TableRow對(duì)象,設(shè)置布局的參數(shù)值。將磚塊添加到上面創(chuàng)建的行對(duì)象中。使用 findViewById 函數(shù)獲得TableLayout(雷區(qū))的樣本。將上邊創(chuàng)建的行添加到TableLayout中代碼如下:private TableLayout mineField。 // table layout to add mines toprivate Block blocks[][]。 // blocks for mine fieldPublic void onCreate(Bundle savedInstanceState){ ... mineField = (TableLayout)findViewById()。}Private void showMineField(){ for (int row = 1。 row numberOfRowsInMineField + 1。 row++) { TableRow tableRow = new TableRow(this)。 (new LayoutParams((blockDimension + 2 * blockPadding) * numberOfColumnsInMineField, blockDimension + 2 * blockPadding))。 for (int column = 1。 column numberOfColumnsInMineField + 1。 column++) { blocks[row][column].setLayoutParams(new LayoutParams( blockDimension + 2 * blockPadding, blockDimension + 2 * blockPadding))。 blocks[row][column].setPadding(blockPadding, blockPadding, blockPadding, blockPadding)。 (blocks[row][column])。 } (tableRow,new ( (blockDimension + 2 * blockPadding) * numberOfColumnsInMineField, blockDimension + 2 * blockPadding))。 }}private TableLayout mineField。 // table layout to add mines toprivate Block blocks[][]。 // blocks for mine fieldpublic void onCreate(Bundle savedInstanceState){ ... mineField = (TableLayout)findViewById()。}private void showMineField(){ for (int row = 1。 row numberOfRowsInMineField + 1。 row++) {TableRow tableRow = new TableRow(this)。 (newLayoutParams((blockDimension+2*blockPadding)* numberOfColumnsInMineField, blockDimension + 2 * blockPadding))。 for (int column = 1。 column numberOfColumnsInMineField + 1。 column++)
點(diǎn)擊復(fù)制文檔內(nèi)容
醫(yī)療健康相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1