android 的動態事件

剛剛學安卓,看到書中的事件一直是固定死的,我對 java  上的這個還不太清楚,應該是什麼匿名類吧,覺得不爽,事件應該是可以在運行時指定的,這樣才靈活於是就從網上搜(我的基礎差,沒有辦法)。實驗成功的代碼: package android.zziss.hello;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.widget.Button;import

實現Android和PC之間的藍芽通訊

      

Cocos2d on Android step by step

  費了九牛二虎之力,終於把Cocos2d在Andriod上跑通了。在安裝期間碰到了各種各樣的坑,這裡我把這些坑總結一下。  通過Cocos2dx官方資料知道要在Andriod下搭建環境需要四樣前置條件:cygwinndkcocos2dxandroid-sdk-tools  上述前置條件各自的用途請自行google。這裡只描述搭建環境中所遇到的坑。  1.cygwin  安裝cygwin  坑1-1.通過一番搜尋,包括小白的Blog,裝起來那叫一個慢啊~經常到一半中斷,總之下了2天沒下完,換鏡像

自訂 listivew (android)

剛學 listview ,參考網上的教程http://www.cnblogs.com/allin/archive/2010/05/11/1732200.html自己實現了一個 listview ,使用的是 SimpleAdapter

自動完成AutoCompleteTextView(android)

自動完成就是在輸入框中輸入字母,然後自己找到相近的詞,這個在 android 中需要先把詞給指定出來,書中用到的是 靜態數組,這裡改成了資源檔有兩個自動完成的輸入框:AutoCompleteTextView 與 MultiAutoCompleteTextView 區別是:   AutoCompleteTextView 只能自動完成一個,而 MultiAutoCompleteTextView 可以自動完成多個,中間是用 逗號分開的代碼很簡單java代碼:package zziss.android.

RadioButton練習(android)

Radio 單選是由 RadioGroup 與 RadioButton

CheckBox練習(android)

CheckBox練習:  checkbox 和 radioButton 相比,不需要 RadioGroup ,每個 checkbox 是單獨的控制項,使用很簡單 isChecked 是擷取是否選擇中,選擇時有 CheckedChangeListener 監聽,具體請看代碼 java 代碼,該代碼簡化了在每個chekcbox 中寫 setOnCheckedChangeListener

ImageButton 練習(android)

ImageButton 是就圖片按紐,指定一個圖片資源,就可以,其它的使用和 Button 是一樣的,這裡再熟悉一下對話方塊的使用,代碼如下xml

對話方塊的練習(android)

android 中的 AlertDialog 對話方塊由 AlertDialog.builder 進行建立,建立後使用 show 顯示,使用簡單,代碼如下 對話方塊的 xml 定義 <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent" 

下拉式清單 spinner(android)

下拉式清單 spinner,這個使用很簡單,在 xml 中定義一個標籤,然後指定 ArrayAdapter<String> 就可以了,Adapter 需要指定下拉的布局。關於下拉的資料,書中是寫用靜態數組,我這裡改成了從資源檔中讀取java

調試 android 工程時出現 Unable to upload file: No space left on device

在調試時出現了:java.io.IOException: Unable to upload file: No space left on device原因是我的 apk 太大了,解決方案找到 avd 目錄 下的模擬器目錄C:\Documents and Settings\qijianzhou\.android\avd\advv4.avd修改 config.ini 檔案添加一句 disk.dataPartition.size=1024 hw.lcd.density=120sdcard.size=5

Gallery練習(android)

Gallery 是顯示圖片用的,需要指定一個圖片的來源 adapter ,這個繼承自 BaseAdapter ,具體代碼如下xml

Android Toast帶表徵圖水平布局的簡單實現

//建立Toast對象 02            Toast mToast = Toast.makeText(ShareYourLifeActivity.this, "記憶卡不可用,請檢查...", Toast.LENGTH_LONG); 03              04            //建立LinearLayout布局 05            LinearLayout toastView = (LinearLayout) mToast.getView(); 06      

ImageView的使用(android)

在 android 中顯示圖片使用的是 ImageView ,這裡的代碼是從書中的例子來的,使用很簡單,現在才覺得 android開發真的好方便呀代碼如下:xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:

ImageSwitcher 練習(android)

ImageSwitch 需要一個 ViewFactory 介面方法,返回一個 ImageView 對像,同時指定 setFactory 方法其中試了試用 ImageView 實現 ImageSwitcher

Android團隊提供的樣本項目

1、Android團隊提供的樣本項目  如果不是從學習Android SDK中提供的那些範例代碼開始,可能沒有更好的方法來掌握在Android這個架構上開發。由Android的核心Team Dev提供了15個優秀的樣本項目,包含了遊戲、影像處理、時間顯示、開始菜單捷徑等。  地址:http://www.apkbus.com/android-13506-1-1.html  2、 Remote Droid  RemoteDroid是一個Android應用,能夠讓使用者使用自己的無線網路使用無線鍵盤、

android 布局檔案屬性說明)

常用的一些屬性說明     android:id  --- 為控制項指定相應的ID     android:text --- 指定控制項當中顯示的文字,需要注意的是,這裡盡量使用strings.xml檔案當中的字串     android:grivity --- 指定控制項的基本位置,比如說置中,居右等位置 這裡指的是控制項中的文本位置並不是控制項本身。     android:textSize --- 指定控制項當中字型的大小     android:background ---

使用android:layout_weight解決布局時把按紐壓到螢幕外的問題

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical" >    <Galle

SharedPreferences 儲存(android)

SharedPreferences 儲存,這個常用於程式內的一些配置項的儲存,使用比 symbian 要簡單好多,代碼很簡單,測試時使用的是 String

Android隱藏標題列,全螢幕顯示

 Android 1.5測試通過 只需在以下代碼中的,setCurrentView();之前調用即可http://hi.baidu.com/wishwingliao/blog/item/38feb71c994ae98587d6b6e0.html  /**     * 標題列隱藏,在Activity.setCurrentView();之前調用此方法     */    private void HideTitle()    {        requestWindowFeature(

總頁數: 2771 1 .... 359 360 361 362 363 .... 2771 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.