Time of Update: 2018-12-03
public class FileServiceTest extends AndroidTestCase{ private static final String TAG = "FileServiceTest"; public void testRead() throws Throwable { FileService service = new FileService(this.getContext()); String result =
Time of Update: 2018-12-03
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallerylayout" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Gallery android:id="@+id/overview"
Time of Update: 2018-12-03
顯示單位px和dip以及sp的區別dip: device independent pixels(裝置獨立像素). 不同裝置有不同的顯示效果,這個和裝置硬體有關,一般我們為了支援WVGA、HVGA和QVGA 推薦使用這個,不依賴像素。px: pixels(像素). 不同裝置顯示效果相同,一般我們HVGA代表320x480像素,這個用的比較多。 pt: point,是一個標準的長度單位,1pt=1/72英寸,用於印刷業,非常簡單易用; sp: scaled pixels(放大像素).
Time of Update: 2018-12-03
Android的控制項非常漂亮,但不得不承認,也有缺點就是控制項功能的弱小。弱小得一個Radio只能放一個text,而沒有value(key)可以存放。使的一個RadioGroup裡的RadioButton可以,同時被選擇。如果是選擇性別男女 ,豈不成了半男不女的人了。
Time of Update: 2018-12-03
使用前的設定 google地圖給人們的生活帶來了極大的方便,例如,可以通過google地圖尋找商戶資訊、查看地圖和擷取行車路線等。android平台也提供了一個map包(com.google.android.maps),通過其中的mapview就能夠方便地利用google地圖的資源來進行編程。在使用前需要預先進行如下必要的設定。 (1)添加maps.jar到項目 在android
Time of Update: 2018-12-03
長按事件的原理及程式碼範例對於很多遊戲使用螢幕控制一般需要考慮長按事件,比如在動作類的遊戲中需要長按發射武器,結合Android Button模型,我們實現一個帶圖片的Button的長按,為了更清晰的顯示原理,Android開發網這裡使用ImageButton作為基類。public class RepeatingImageButton extends ImageButton { private long mStartTime; //記錄長按開始 private int
Time of Update: 2018-12-03
Android開發環境搭建 1 準備程式 Android系統主要是基於java語言開發的,在開始之前,要先準備如下作業環境以及程式: (1) Java JDK:: p://www.oracle.com/technetwork/java/javase/downloads/index.h tml http://java.sun.com/javase/downloads/index.jsp只需要下載JDK,無需下載jre,JDK下載完成後點擊安裝,不需要設定環境變數即可使用。 (2)
Time of Update: 2018-12-03
1:註冊使用者,下載jar包: 去 http://www.youmi.net/ 註冊個賬戶,然後 添加一個應用2:在manifest.xml檔案中配置:<uses-permission android:name="android.permission.INTERNET"
Time of Update: 2018-12-03
第一個activitypackage com.qualitypicture.activity;import java.util.ArrayList;import java.util.List;import com.qualitypicture.R;import android.app.Activity;import android.content.Context;import android.content.Intent;import android.os.Bundle;import
Time of Update: 2018-12-03
SurfaceView是從View基類中派生出來的顯示類,直接子類有GLSurfaceView和VideoView,可以看出GL和視頻播放 以及Camera網路攝影機一般均使用SurfaceView,到底有哪些優勢呢? SurfaceView可以控製表面的格式,比如大小,顯示在螢幕中的位置,最關鍵是的提供了SurfaceHolder類,使用getHolder方法 擷取,相關的有Canvas lockCanvas()、 Canvas lockCanvas(Rect dirty)
Time of Update: 2018-12-03
Wrong orientation? No orientation specified, and the default is horizontal, yet this layout has multiple children where atleast one has
Time of Update: 2018-12-03
1,android:orientation 布局方向。horizontal是讓所有的子項目按水平方向從左至右排列, vertical是讓所有的子項目按豎直方向從上到下排列。 2,android:gravity 與 android:layout_gravity的區別android:gravity是指定本元素的子項目相對它的對齊。 android:layout_gravity是指定本元素相對它的父元素的對齊。 例如:
Time of Update: 2018-12-03
ZZ: http://blog.csdn.net/sergeycao/article/details/8198205一、如何將帶源碼的APK預置進系統?1) 在 packages/apps 下面以需要預置的 APK的 名字建立一個新檔案夾,以預製一個名為Test的APK 為例2) 將 Test APK的Source code 拷貝到 Test 檔案夾下,刪除 /bin 和 /gen 目錄3) 在 Test 目錄下建立一個名為
Time of Update: 2018-12-03
public class FileService{ private Context context; public FileService(Context context) { this.context = context; } public void saveToSDCard(String filename, String content) throws Exception { File file = new
Time of Update: 2018-12-03
public class LoadActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE);//
Time of Update: 2018-12-03
SharedPreferences prefs = Utils.getSharedPreferences(context);boolean autostart = prefs.getBoolean(SettingsPreferences.KEY_BOOT_CFG, false);public static SharedPreferences getSharedPreferences(Context context) {return
Time of Update: 2018-12-03
添加圖片按鈕<ImageButton android:id="@+id/set" android:layout_width="190dp" android:layout_height="67dp" android:layout_marginLeft="45dip" android:layout_marginTop="195dip" android:scaleType="fitXY"
Time of Update: 2018-12-03
<?xml version="1.0" encoding="utf-8"?><!--android:layout_above 將該控制項的底部至於給定ID的控制項之上android:layout_below 將該控制項的頂部至於給定ID的控制項之下android:layout_toLeftOf 將該控制項的右邊緣和給定ID的控制項的左邊緣對齊android:layout_toRightOf
Time of Update: 2018-12-03
URL url = new URL(urlString);File tempFile = null;tempFile = File.createTempFile("cache", ".tmp", new File(Environment.getExternalStorageDirectory().toString()));boolean downloaded = DownloadUtils.requestDownload(url, tempFile);public class
Time of Update: 2018-12-03
顏色代碼:顏色代碼: 1白色 #FFFFFF 2 紅色 #FF0000 3 綠色 #00FF00 4 藍色 #0000FF 5 牡丹紅 #FF00FF 6 青色 #00FFFF 7 黃色 #FFFF00 8 黑色 #000000 9 海藍 #70DB93 10 巧克力色 #5C3317 11 藍紫色 #9F5F9F 12 黃銅色 #B5A642 13 亮金色 #D9D919 14 棕色 #A67D3D 15 青銅色 #8C7853 16 2號青銅色 #A67D3D 17 士官服藍色 #5F9F9