Time of Update: 2018-12-06
沒事逛論壇,無意間看到了一篇非常不錯的文章,轉載如下: 開篇語:最近程式在做一個小效果,要用到touch,結果整得雲裡面霧裡的,乾脆就好好把android touch機制好好看了一下,呵呵。。 android系統中的每個ViewGroup的子類都具有下面三個和TouchEvent處理密切相關的方法: 1)public boolean dispatchTouchEvent(MotionEvent ev) 這個方法用來分發TouchEvent 2)public boolean
Time of Update: 2018-12-06
一、什麼是XMPP?Extensible Messaging and Presence Protocol,簡單的來講,它就是一個發送接收處理訊息的協議,但是這個協議發送的訊息,既不是二進位的東東也不是字串,而是XML。二、什麼是IM?Instant Messenger,及時通訊軟體,就是大家使用的QQ、MSN Messenger和Gtalk等等。其中Gtalk 就是基於XMPP 協議的一個實現,其他的則不是。當前IM
Time of Update: 2018-12-06
最基本分享方法:Intent intent = new Intent(Intent.ACTION_SEND); // 啟動分享發送的屬性intent.setType("text/plain"); // 分享發送的資料類型intent.setPackage(packAgeName);intent.putExtra(Intent.EXTRA_SUBJECT, "xx分享"); // 分享的主題intent.putExtra(Intent.EXTRA_TEXT, "分享內容"); // 分享的內容mA
Time of Update: 2018-12-06
剛開始搭建開發環境的時候,有幾個容易出問題的地方,記下來以備參考。 必須的程式: Eclipse,java的IDE,:http://www.eclipse.org/downloads/ JDK,:http://www.oracle.com/technetwork/java/javase/downloads/index.html其他很多資料上給的都是Sun的,因為Oracle已經把Sun收購了,因此現在地址已經都換了。 Android
Time of Update: 2018-12-06
新版本在智能提示的時候經常卡死,找了很多辦法,但很多也不管用。今天終於解決了: http://www.cnblogs.com/zenghanxi/archive/2010/08/13/1799229.html 新下了eclipse3.6,很開心,多了一些新功能。好景不長,沒用多久就卡起來了,又下了個最瘦的那個版本都卡,找了好久,關了很多東西都沒有用,終於發現原來是 "Usage Data Collector"
Time of Update: 2018-12-06
// 建立一個toast對象private Toast toast; public void showMsg(String arg) { if (toast == null) { toast = Toast.makeText(this, arg, Toast.LENGTH_SHORT); } else { toast.cancel(); toast.setText(arg); }
Time of Update: 2018-12-06
參考 Android拍照、錄影、錄音代碼範例 public class MyCameraActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
Time of Update: 2018-12-06
代碼與範例:首先需要在Manifest檔案中添加以下內容:以使程式擷取網路攝影機使用以及自動對焦功能的使用許可權。CameraTestActivity.javaimport android.app.Activity;import android.os.Bundle;import android.view.Window;import android.view.WindowManager;public class CameraTestActivity extends Activity {
Time of Update: 2018-12-06
先在 Manifest 裡添加許可權<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />然後在 mainActivity 添加方法SQLiteDatabase db; private final String
Time of Update: 2018-12-06
布局檔案<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical" android:layout_width="fill_parent"android:layout_height="fill_parent"><TableLayout
Time of Update: 2018-12-06
public class CreateFile extends Activity { private BufferedReader reader; private TextView tvFileReader; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {
Time of Update: 2018-12-06
public class Test extends Activity implements OnClickListener { private EditText etName; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
Time of Update: 2018-12-06
建一個AsyncLoadedImage類繼承AsyncTask非同步載入類,調用publishProgress方法更新onProgressUpdate貯存縮圖資訊到Adapter。監聽Adapter Change實現非同步載入縮圖。main.xml<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2018-12-06
關於Android布局,之前給大家分享了不少,感謝這些文章的原作者,先來一起回顧一下:Android中LinearLayout、AbsoluteLayout使用介紹Android布局之RelativeLayout、FrameLayout使用介紹Android布局之TableLayout使用介紹Android布局之TableLayout實現九宮圖好吧,那就天就來講講Android中ListView的用法,原文如下:ListView是一個經常用到的控制項,ListView裡面的每個子項Item可以使
Time of Update: 2018-12-06
main.xml<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/arc_hf_search_result" android:layout_width="match_parent" android:layout_height="match_parent"
Time of Update: 2018-12-06
package com.nico; import android.app.Activity; import android.app.DatePickerDialog; //import android.app.TimePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.util.Log; import android.view.View; import
Time of Update: 2018-12-06
先來看看吧welcome_glide.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent"
Time of Update: 2018-12-06
使用ListView和arrayAdapter布局,是ListView布局中最為簡單的一種,首先我們會建立一個組件用來顯示資料,例如main.xml <?xml version="1.0" encoding="utf-8"?> <!-- 主介面本身就是一個顯示組件 --> <TextView xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2018-12-06
本人用的MIUI
Time of Update: 2018-12-06
main.xml主布局檔案,代碼<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent"