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

正文內(nèi)容

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

2024-07-20 16:05 本頁面
 

【文章內(nèi)容簡介】 視操作,提取代碼圖25 建立AVD圖26 運行結(jié)果:圖27圖28圖29圖30 掃雷游戲運行分析游戲的目的是在沒有觸碰任何一個地雷的情形下清空一個雷區(qū)。掃雷不僅有Windows版本,也有其他平臺的版本(包括大多數(shù)Linux的變體)。掃雷在Windows的用戶中十分流行,自從Windows 。在掃雷游戲中,游戲者要面對一片磚塊組成的格柵,有些磚塊包含隨機設(shè)置的地雷。我們將實現(xiàn)一個典型的初學(xué)者級別掃雷游戲:行和列的數(shù)量都是9,一共有10顆地雷。擴展成中級和高級游戲很容易(只需要改編代碼中的上述三個值)。在實現(xiàn)前我們需要了解這個游戲的一些特點(Windows版本):點擊左鍵打開一個磚塊。點擊右鍵對磚塊進(jìn)行標(biāo)記:插旗幟(表示下面有雷),標(biāo)問號(不確定是否有雷),取消標(biāo)記第一個磚塊下面永遠(yuǎn)沒有雷;避免了一開始就要猜測的煩惱。如果打開的磚塊是空的,周圍的磚塊都會依次打開直到遇到數(shù)字磚塊。解釋和實現(xiàn)任何復(fù)雜系統(tǒng)的最好方法是一次一步進(jìn)行。首先探討布局和應(yīng)用的視覺及創(chuàng)建布局時用到的一些技術(shù)。然后討論鼠標(biāo)、點擊和觸摸事件的區(qū)別以及應(yīng)用的反應(yīng)。最后實現(xiàn)整個游戲以及上面介紹過的功能。我們將利用該較大難度的開源程序進(jìn)行程序分析解析。圖31使用TableLayout進(jìn)行掃雷的布局,在TableLayout上加入三行: 第一行包括用于計時的三列數(shù)字,新游戲按鈕和剩余地雷數(shù)。我們使用TextView顯示計時和地雷數(shù)。新游戲按鈕使用ImageButton。第二行是50像素高的空的TextView,將第一行和雷區(qū)隔離開。第三行是另一個TableLayout,用來顯示雷區(qū)。我們將動態(tài)的向這個區(qū)域添加按鈕。圖32布局的代碼如下(刪去了一些額外的屬性來節(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我們使用外部字體來顯示時間和地雷數(shù)。在Android中使用外部字體很容易,分為兩步: 在工程的assets文件夾下創(chuàng)建字體文件夾,復(fù)制TTF(True Type Font)文件至字體文件夾。通過調(diào)用createFromAsset 和傳遞TTF文件名創(chuàng)建一個Typeface對象。在這個對象中設(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)在我們的掃雷游戲里,點擊新游戲的笑臉按鈕會讓這個笑臉變成緊張的表情。當(dāng)按鈕處于按壓狀態(tài)時(緊張的笑臉),我們需要一個不同的圖像。當(dāng)它處于正常狀態(tài)時需要另一張圖像。為了實現(xiàn)此功能,我們使用風(fēng)格,效果如下: 圖33使用風(fēng)格也需要兩步:創(chuàng)建一個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中的動態(tài)行動態(tài)添加磚塊的原理相同(磚塊是從按鈕類繼承的類,包含支持實現(xiàn)的額外功能)。我們希望它們像預(yù)想的那樣工作,分為如下的幾步: 創(chuàng)建一個TableRow對象,設(shè)置布局的參數(shù)值。將磚塊添加到上面創(chuàng)建的行對象中。使用 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++)
點擊復(fù)制文檔內(nèi)容
醫(yī)療健康相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1