Time of Update: 2018-12-03
一個LeveListDrawable管理著一組交替的drawable資源。LeveListDrawable裡面的每一個drawable資源與一個最大數值結合起來,作為LevelListDrawable資源的一項。調用Drawable的setLevel()方法可以載入level-list或代碼中定義的某個drawable資源,判斷載入某項的方式:level-list中某項的android:maxLevel數值大於或者等於setLevel設定的數值,就會被載入。檔案位置:res/drawable/f
Time of Update: 2018-12-03
不多說了,直接上代碼吧!!!package com.example.suspendedwindowdemo;import android.content.Context;import android.view.Gravity;import android.view.MotionEvent;import android.view.View;import android.view.View.OnTouchListener;import
Time of Update: 2018-12-03
1、選擇菜單 Project >> Clean ,前提是勾選上 Bulid Automatically(自動構建部署) , 點Clean後會重新構建項目,因為一般情況下,R.java檔案在這個時候會重新更新產生一邊,如果工程有錯,就不會自動產生。 2、選擇工程,右鍵 Android Tools >> Fix Project
Time of Update: 2018-12-03
> 1. what is the relationship between ViewRoot and View class.The ViewRoot is the root of each view hierarchy. Like you said, thereis one ViewRoot per window. The ViewRoot is responsible to handlingthe layout and drawing of the view hierarchy.
Time of Update: 2018-12-03
--1.找到setting項目的原始碼:android2.2/packages/apps/Settings/--2.拷貝 到你的workspace--3.以setting為原始碼建立一個新的android項目--4.這個時候項目會有一些錯誤需要解決,先要引入framework編譯產生的Jar包classes.jar,保證我們項目能夠被正常編譯,這個很久弄過,路徑不知道是否正確,這裡提供一個參考的路徑:android2.2/out/target/common/obj/JAVA_LIBRARIES/
Time of Update: 2018-12-03
busybox可以提供很多常見的linux命令的實現,在android調試時很有用,安裝busybox需要已經擷取手機root許可權 。1. 下載檔案在http://www.busybox.net/downloads/binaries/選擇armv6l下載2. 將下載的檔案傳輸到手機的Sdcard中:adb push busybox /sdcard/3. 將busybox放入/system/xbin目錄:adb shellsumount -rw -o remount /systemcat
Time of Update: 2018-12-03
原文地址:http://developer.android.com/tools/testing/testing_android.htmlandroid 測試架構是開發環境的一部分,它提供了 an architecture
Time of Update: 2018-12-03
工欲善其事必先利其器 , 下面介紹下 Eclipse SDK NDK Cygwin CDT 整合式開發環境的搭建。1、Android 開發環境搭建Android開發環境搭建不是重點,相信看此文章的很多人都已經搭建成功,這裡隨便概述性的說說。1) 下載 JDK2) 下載 Eclipse3) 下載 Android SDK4) 啟動Eclipse , 安裝 ADT2、下載安裝Android NDK我使用的NDK版本為r5Google 出的最新NDK 為 r6 為
Time of Update: 2018-12-03
android native開發偶爾會遭遇native庫異常導致程式崩潰,打入來的log如下:06-05 18:52:57.566: I/DEBUG(8139): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***06-05 18:52:57.566: I/DEBUG(8139): Build fingerprint: 'htc_asia_wwe/htc_saga/saga:2.3.3/GRI40/27073:user/
Time of Update: 2018-12-03
Android 中涉及資料庫查詢的地方一般都會有一個 query() 方法,而這些 query 中有大都(全部?)會有一個參數 selectionArgs,比如下面這個 android.database.sqlite.SQLiteDatabase.query():public Cursor query (String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String
Time of Update: 2018-12-03
第一步:顯示一張圖片:方法一、public class PicshowMainActivity extends Activity {LinearLayout mLinearLayout;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);this.mLinearLayout = new LinearLayout(this);ImageView i =
Time of Update: 2018-12-03
1、安裝Android SDK官網上下載linux版本的SDK包:http://developer.android.com/sdk/index.html,之後直接解壓縮檔案,找到tools檔案夾下的android檔案,直接雙擊運行,會出現Android SDK and AVD
Time of Update: 2018-12-03
public void pullCreateXml() throws IllegalArgumentException, IllegalStateException, IOException{//要儲存的資料Person person1=new Person(1, "Lucy", 15);Person person2=new Person(2, "Tim", 20);List<Person> persons=new ArrayList<Person>();persons.
Time of Update: 2018-12-03
Drawable Resource一個Drawable資源是繪圖中的一個普通概念,可以再螢幕上繪製出來。可以通過APIs中的getDrawable(int)方法檢索出來,也可以在其他的XML資源中通過android:drawable和android:icon等屬性使用它。Android中有多種不同類型的drawable。Bitmap File:一個位元影像檔案(.png,.jpg,或.gif), 產生一個BitmapDrawable對象.Nine-Patch
Time of Update: 2018-12-03
動態產生介面的方法很簡單首先要卻這個介面的布局,是AbsoluteLayout,RelativeLayout還是其他,然後就可以再裡面添加控制項了:public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);//確定介面的布局AbsoluteLayout abslayout=new AbsoluteLayout
Time of Update: 2018-12-03
在做手機開發的時候,我們有時會使用到感應器,特別是在遊戲開發中。下面我沒來學習一下感應器的擷取。在這裡我們需要一部真實的android手機,我使用的是華為的c8650。擷取手機中的感應器的步驟為:擷取SensorManager對象執行SensorManager對象的getDefaultSensor()方法擷取Sensor對象,這裡getDefaultSensor()方法要傳遞一個參數,指定具體的感應器類型擷取Sensor對象中的各種屬性不說那麼多了,先看看我的運行效果吧:介面:點擊按鈕後得到資料
Time of Update: 2018-12-03
Android平台手機5大優勢: 一、開放性 在優勢方面,Android平台首先就是其開發性,開發的平台允許任何移動終端廠商加入到Android聯盟中來。顯著的開放性可以使其擁有更多的開發人員,隨著使用者和應用的日益豐富,一個嶄新的平台也將很快走向成熟。 開發性對於Android的發展而言,有利於積累人氣,這裡的人氣包括消費者和廠商,而對於消費者來講,隨大的受益正是豐富的軟體資源。開放的平台也會帶來更大競爭,如此一來,消費者將可以用更低的價位購得心儀的手機。 二、掙脫電訊廠商的束縛 在
Time of Update: 2018-12-03
最近在做項目的時候,需要適應橫,豎屏,為了資料和整體效果,就在activity的配置中加了以下的:android:configChanges="keyboardHidden|orientation"但加了之後還是會經常onCreate,一直就覺得奇怪,之前一直不會的,後來發現才知道了,還需要加點東西,,android:configChanges="keyboardHidden|orientation|screenSize“http://developer.android.com/guide/to
Time of Update: 2018-12-03
相信很多同學都會有操作SQLite不方便的感覺,對於資料庫操作又不能很明顯地看出問題,這裡我們就接上一章的SQLite操作輔助類進行單元測試,OK,我們來看一下類碼:首先是DatabaseHelper.javaimport android.content.Context;import android.database.sqlite.SQLiteDatabase;import android.database.sqlite.SQLiteOpenHelper;public class
Time of Update: 2018-12-03
接著上面一章,這次我們將資料存放區在File檔案裡,布局檔案沒什麼改變,還是一樣的布局,看main.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"