Time of Update: 2016-04-03
標籤:call/apply函數作用其實就是改變this的取值,有一句話是:誰調用的這個方法那方法裡的this就是指誰,而有時我們會需要改變this值,所以call/apply就能派上用場。下面我寫個方法來類比JQuery中的each方法來加深對call/apply函數的理解代碼如下:1 function each(arr, callback) {2 for (var i = 0; i < arr.length; i++) {3
Time of Update: 2016-04-03
標籤:#import "CXDWaterflowLayout.h"/** 預設的列數 */static const NSInteger CXDDefaultColumnCount = 3;/** 每一列之間的間距 */static const CGFloat CXDDefaultColumnMargin = 10;/** 每一行之間的間距 */static const CGFloat CXDDefaultRowMargin = 10;/** 邊緣間距 */static const
Time of Update: 2016-04-03
標籤:在輸入框中加入android:imeOptions="actionSearch",調用軟鍵盤時,斷行符號鍵就會顯示搜尋二字。我想在點擊搜尋時,跳轉到下一個頁面,但是調用setOnKeyListener,每次都執行兩次。最後上網看到別人的文章,解決了問題,解決方案是調用setOnEditorActionListener而不是用setOnKeyListener來監聽點擊搜尋按鈕。代碼如下(在fragment中寫的,在activity中寫的時候去掉context相關的東西就行了):searchT
Time of Update: 2016-04-03
標籤:Android Intent參數this問題 (2013-04-02 11:19:48)轉載▼標籤: android intent分類: Android轉自:http://blog.csdn.net/jiangxinyu/article/details/8572280 The constructor Intent(new XXX.OnclickListener(){}, Class) is
Time of Update: 2016-04-03
標籤:<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hanqi.test5"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"
Time of Update: 2016-04-03
標籤:getIntent().getExtras().get("intent"); 這個intent是資料封裝的參數。 比如: Intent intent = new Intent(this, YouClass.class); intent.putExtra("data1","youdata"); startActivit(intent ); 擷取資料 getIntent().getExtras().get("data1");不用執行個體化 就像引用的就只有類裡面設為靜態方法的資料和方法才行 &
Time of Update: 2016-04-03
標籤:Android:控制項AutoCompleteTextView 自動提示在輸入框中輸入我們想要輸入的資訊就會出現其他與其相關的提示資訊,這種效果在Android中是用AutoCompleteTextView實現的。xml<AutoCompleteTextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/autotext"
Time of Update: 2016-04-03
標籤:一、匯入源碼1、首先在根目錄執行 :source build/envsetup.sh2、然後執行:mmm development/tools/idegen/ //這行命令的意思是編譯idegen這個項目,產生idegen.jar檔案3、sh ./development/tools/idegen/idegen.sh // 這行命令的意思是產生對應的檔案:android.iws, android.ipr,
Time of Update: 2016-04-03
標籤:Android_TextView屬性XML詳解部落格分類: android Java代碼 屬性名稱 描述 android:autoLink 設定是否當文本為URL連結/email/電話號碼/map時,文本顯示為可點擊的連結。可選值(none/web/email/phone/map/all) android:auto
Time of Update: 2016-04-03
標籤:使用httpclient協議訪問網路:public class MainActivity extends Activity implements OnClickListener{ public void onClick(View v){ if(v.getId()==R.id.send_request){ sendRequestWithHttpClients(); } } private void
Time of Update: 2016-04-03
標籤:轉自:http://ghostfromheaven.iteye.com/blog/752181Android
Time of Update: 2016-04-03
標籤:Android 系統源碼下載及編譯1 首先你的JDK和Git是已經安裝成功了。(百度)2 如果使用的是Ubuntu64的系統,則需要安裝的軟體包:(其他的ubuntu系統有不同的下載包,具體查看官網文檔https://source.android.com/source/initializing.html) sudo apt-get install git-core gnupg flex bison gperf
Time of Update: 2016-04-03
標籤:<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hanqi.test5"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"
Time of Update: 2016-04-03
標籤: 介面布局和上一節的mp3基本一樣,播放視頻需要一個控制項SurfaceView SurfaceView控制項在內部維護了一個雙緩衝的技術,使用兩個線程進行解析幀和顯示到介面上在Activity的onCreate()方法裡面,找到控制項對象其他代碼和上一節的音頻播放一致找到MediaPlayer對象調用setDataSource()方法,之前調用MediaPlayer對象的setDisplay()方法,設定影片以SurfaceHolder的方式播放,參數:Surface
Time of Update: 2016-04-03
標籤:JDK環境變數的配置:右擊“電腦”或“我的電腦”,選擇“屬性”-->“進階”或“進階系統設定”(例如以下圖1)-->“環境變數”(例如以下圖2),例如以:圖1圖2單機“環境變數”。出現例如以3的介面。圖3然後在“系統變數”處選擇“建立”(紅色標記處)。出現例如以4介面,圖4以下進行正式的配置部分:(1)在“變數名”處輸入“JAVA_HOME”,在“變數值”中輸入JDK的安裝資料夾(安裝JDK檔案夾下有jre檔案夾、bin檔案夾和lib檔案夾等)。(2)再建立一個變
Time of Update: 2016-04-03
標籤: 啟動模式一共有四種,分別是 standard、singleTop、singleTask 和 singleInstance , 可 以 在 AndroidManifest.xml 中 通 過 給 標 簽 指 定android:launchMode 屬性來選擇啟動模式。在實際項目中我們應該根據特定的需求為每個活動指定恰當的啟動模式。1. standardstandard
Time of Update: 2016-04-03
標籤:一、隱藏自身軟鍵盤當對於有多個UITextField控制項都想通過點擊“Return”來隱藏自身軟鍵盤的情況。這時的最好辦法是使用Did End on Exit事件。在點擊軟鍵盤右下角的“Return”button後,會觸發該事件。該事件有一個sender參數表示當前文字框。這樣便能夠編寫一個通用的事件處理方法(.m檔案)——- (IBAction)TextField_DidEndOnExit:(id)sender { // 隱藏鍵盤. [sender
Time of Update: 2016-04-03
標籤:- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ // 1.URL NSURL *url = [NSURL URLWithString:@"http://localhost:8080/MJServer/order"]; // 2.請求 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; // 3.要求方法
Time of Update: 2016-04-03
標籤:1. 請描述一下Activity 生命週期。答: 如所示。共有七個周期函數,按順序分別是: onCreate(), onStart(), onRestart(), onResume(), onPause(),onStop(), onDestroy()。onCreate(): 建立Activity時調用,設定在該方法中,還以Bundle的形式提供對以前儲存的任何狀態的訪問。onStart(): Activity變為在螢幕上對使用者可見時調用。onResume():
Time of Update: 2016-04-03
標籤:這裡使用的是NSURLConnection的代理請求下載,並且是具有進度,UI能即時重新整理,至於NSURLConnection如何請求、並且有幾種要求方法請看NSURLConnection請求簡介,在這裡的話我們以下載一本書籍為例,下面為它的地址(這是在百度雲裡面弄的,連結是別人加密了,所有比較長)http://d.pcs.baidu.com/file/2b66fa1c93d8322d5299a1befc59b16c?fid=204559171-250528-10422866753183