Time of Update: 2018-12-06
先瞭解一下AndroidManifest.xml。就是功能資訊清單檔。(以後廣播接收器、音樂播放器,都是在這定義)
Time of Update: 2018-12-06
JSON例子一 MainActivity.java中 核心代碼 private String jsonData = "{\"name\":\"Michael\",\"age\":20}"; MainActivity.java 1 import android.app.Activity; 2 import android.os.Bundle; 3 import android.view.View; 4 import android.view.View.OnClickListener; 5
Time of Update: 2018-12-06
網址:http://www.dianjoy.com/dev/register.php?ref_email=348293362%40qq.com方法:步驟一:將youmiad-android.jar 匯入您的工程中。1 右鍵您的工程根目錄,選擇“Properties”2 在左面板中選擇“Java Build Path”3 然後選擇“Libraries”標籤4 點擊“Add External JARs…”5 選擇youmiad-android.jar 的目錄路徑6 點擊“OK”即匯入成功======
Time of Update: 2018-12-06
這兩個方法的效果是一樣,只是區別於效率!Java代碼:playBtn.setBackgroundResource(R.drawable.pause_selecor);從上面可以看出來是從資源檔中擷取drawable中的pause_selecor對象,如果是經常要用到的drawable對象,就可以讓它成為一個成員變數來使用,例如:在onCreate的時候就讀取一次資源檔將它轉為Drawable對象。Java代碼:pauseSelecor =
Time of Update: 2018-12-06
在eclipse裡建立一個project,選Android-Android Project 然後Next,繼續 解釋一下Package Name:這個學過編程的人都應該熟悉了,類似於namespace,你定義的所有東西都在一個包裡不會和別的包出現重新命名的問題等等,不多說了。Create Activity:在android系統裡,每個程式都是由一個個Activity的運行連成一起的。這裡相當於建立了程式的入口Activity,相當於main()函數。Min SDK
Time of Update: 2018-12-06
在應用中不是很常見自訂的退出彈出框,遊戲中我們經常能看到。下面就看下是怎麼實現的,首先我們定義一個方法,當使用者點擊退出的時候調用這個方法。 1 private void dialog() { 2 final AlertDialog dlg = new AlertDialog.Builder(this).create(); 3 dlg.show(); 4 Window window = dlg.getWindow();
Time of Update: 2018-12-06
最近做一個類似滑動功能表列的title,綁定資料來源用的是GrildView,想要實現橫著滑動並且GrildView只顯示一行。最終採用代碼形式在Activity中動態添加布局實現。 ViewGroup.LayoutParams params = dishtype.getLayoutParams(); // dishtype,welist為ArrayListint dishtypes = welist.size();
Time of Update: 2018-12-06
本程式實現了使用Dom方法從網路端解析xml檔案,展示在列表,並實現點擊進入相關頁面。首先我們建立一個類,用來實現http請求和xml檔案節點的擷取,這裡的http請求很簡單,就傳遞一個url,在代碼中通過這樣的一個方法實現public String getXmlFromUrl(String url) { String xml = null; try { // defaultHttpClient
Time of Update: 2018-12-06
終於發布一個android應用程式到機鋒市場,AppChina應用匯了。機鋒市場和智件園註冊上傳都比較麻煩, AppChina應用匯開始最簡單但後面的驗證還是比較麻煩的而且不能包含廣告和積分的,cmd100以前可以免費發布到google市場的,現在也不行了要收費了。智件園的發布很坑爹,開始是中文的到後面有部分是英文的
Time of Update: 2018-12-06
android 讓一個控制項按鈕居於底部的幾種方法1.採用linearlayout布局:android:layout_height="0dp" <!-- 這裡不能設定fill_parent -->android:layout_weight="1" <!-- 這裡設定layout_weight=1是最關鍵的,否則底部的LinearLayout無法到底部 -->2.
Time of Update: 2018-12-06
// 監聽類private final BroadcastReceiver sdcardListener = new BroadcastReceiver() { @Overridepublic void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.d("TAG", "sdcard action:::::" +
Time of Update: 2018-12-06
一、android有四種預設的Dialog實現:AlertDialog、ProgressDialog、DatePickerDialog、TimePickerDialog。另外你還可以繼承android.app.Dialog實現自已的dialog。 二、AlertDialog是一種能構造預設的一、二、三個按鈕的對話方塊和單選或多選的的選擇對話方塊。 三、ProgressDialog是繼函大自AlertDialog,除了AlertDialog功能外,它還能顯視進度圈或條的對話方塊。 四、Da
Time of Update: 2018-12-06
查詢了google發現在android一下有幾種方法可以做到,但是經過實際測試發現下面這種方法是最準確的Rect bounds = new Rect();String text = "Hello World";TextPaint paint;paint = findViewById(R.id.hello_world).getPaint();paint.getTextBounds(text, 0, text.length(), bounds);int width = bounds.width();
Time of Update: 2018-12-06
Android平台下SeeJoPlayer視頻播放器(功能介紹及源碼解析,附源碼)http://www.blogjava.net/zh-weir/archive/2011/03/23/310617.html 使用Vitamio打造自己的Android萬能播放器(10)—— 本地播放
Time of Update: 2018-12-06
android:layout_above="@id/label" 將此控制項的底部置於給定的控制項之上android:layout_below="@id/label" 將此控制項的頂部置於給定的控制項之下android:layout_toLeftOf="@id/label" 將此控制項的右邊緣同給定ID的控制項的左邊緣對齊android:layout_toRightOf="@id/label"
Time of Update: 2018-12-06
Service是android 系統中的一種組件,它跟Activity的層級差不多,但是他不能自己運行,只能後台運行,並且可以和其他組件進行互動。Service的啟動有兩種方式:context.startService() 和 context.bindService()。 使用context.startService()啟動Service是會會經曆:context.startService() ->onCreate()->onStart()->Servicerunningcon
Time of Update: 2018-12-06
原文地址:http://www.cnblogs.com/jqyp/archive/2010/10/23/1859182.htmlRelativeLayout用到的一些重要的屬性: 第一類:屬性值為true或false android:layout_centerHrizontal 水平置中 android:layout_centerVertical 垂直置中 android:layout_centerInparent 相對於父元素完全置中
Time of Update: 2018-12-06
android-apt-compiler: Cannot run program "D:\android-sdk\platform-tools\aapt裝上IntelliJ IDEA 12.1.3後,編譯Android工程,發現老是報如上錯誤,有人說是ant設定檔SDK什麼路徑不對,但我這裡是對的,後來發現API17把原來plateform-tools下的aapt.exe和lib檔案夾都放到了/build-tools/17.0.0/下去了,於是將aapt.exe,
Time of Update: 2018-12-06
記錄Android學習開發曆程。 2010/1/ 開始學習Android開發。 2010/1/28 《Android A Programmer's Guid》 Jerome (J.F) Dimazio 2010/1 Android 開發人員網站 Dev Guid 部分: http://developer.android.com/guide/index.html 2010/1/29 學習了技術人生先生的視頻,雖然不全,但是還是有收穫。比如 “ Ctrl + F11 ”
Time of Update: 2018-12-06