Time of Update: 2018-12-06
簡單記錄O(∩_∩)O~建立anim目錄,並建立實現旋轉的動畫檔案roraterepeat.xml<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" > <rotate android:duration="1000" android:fromDegrees="0"
Time of Update: 2018-12-06
結構繼承關係public interface IBinderandroid.os.IBinder子類及間接子類間接子類Binder一個遠程對象的基類,IBinder定義一個輕量級的遠端程序呼叫機制的核心部分。 類概述Base interface for a remotable object, the core part of a lightweight remote procedure call mechanism designed for high performance when
Time of Update: 2018-12-06
感應器的種類:1. 動作感應器加速度感應器、重力感應器和陀螺儀(判斷手機姿態)等2. 定位感應器方向感應器和磁力感應器3. 環境感應器溫度感應器 、壓力感應器和亮度感應器 使用感應器的方法:1. 擷取SensorManager對象 SensorManager sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); 2.
Time of Update: 2018-12-06
布局XML: <android.gesture.GestureOverlayView android:id="@+id/gesture1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gestureStrokeType="multiple">
Time of Update: 2018-12-06
已解決:1、Error generating final archive: Debug Certificate expired on 10/09/18 16:30 原因分析:android要求所有的程式必須有簽名,否則就不會安裝該程式。在我們開發過程中,adt使用debug keystore,在
Time of Update: 2018-12-06
直接上代碼,代碼內容上有相應的注釋。效果作簡短介紹,有一個圓形一個方形,當一隻手指觸控的時候只有圓形隨著移動;當兩隻手指觸控的時候圓形與方形各自隨著手指移動。不要忘記使用View.invalidate()對繪圖進行更新。/* import相關class */import android.app.Activity;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;i
Time of Update: 2018-12-06
開啟內建鬧鐘:Intent intent = new Intent();intent.setAction("android.intent.action.SET_ALARM");startActivity(intent); 開啟所有程式的畫面:startActivity(new
Time of Update: 2018-12-06
如何刪除項目的緩衝:getCacheDir()能夠得到當前項目的緩衝地址在項目中經常會使用到WebView 控制項,當載入html 頁面時,會在/data/data/應用package 目錄下產生database與cache 兩個檔案夾。請求的url 記錄是儲存在WebViewCache.db,而url 的內容是儲存在WebViewCache
Time of Update: 2018-12-06
電子羅盤:1. /* 取得SensorManager */ SensorManager mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); 2. /* 取得需要的Sensor,並註冊SensorEventListener */ mSensorManager.registerListener(mSensorEventListener, mSensorManager.getDefaultSensor(
Time of Update: 2018-12-06
Animations一般分為兩大類,一類是漸層的(Tweened):如淡入淡出,旋轉,移動,縮放;另一類是Frame-by-Frame,就如電影一般由多張圖片按照一定的時間間隔顯示。使用Tweened Animations的第一種使用步驟:1. 建立一個AnimationSet對象,AnimationSet animationSet = new AnimationSet (boolean b); //b為true表示共用Interpolator2. 根據需要建立相應的Animation對象(
Time of Update: 2018-12-06
以Nesus s為例,由usb到耳機是Y軸;調節音量到開關螢幕為X軸;螢幕上方向為Z軸。 public class AccessSensorManagerActivity extends Activity {
Time of Update: 2018-12-06
需要解析的XML:<?xml version="1.0" encoding="utf-8"?><persons> <person id="23"> <name>張老師</name> <age>21</age> <persion> <person id="20"> <name>李老師</name> <a
Time of Update: 2018-12-06
轉:http://www.2cto.com/kf/201208/151123.htmlAndroid開發中我們常常需要知道,當前應用的版本資訊。可以進行自動升級判斷。擴充自訂資料 meta-data, 這些資料都在AndroidManifest.xml .我們如何擷取這些資訊呢?下來樣本如何讀取這些資料。1 版本資訊、應用程式名稱2 Appliction 的Meta-data3 Activity中的Meta-dataAndroidManifest.xml中的定義如下:<manifest
Time of Update: 2018-12-06
首先看一下: 項目結構圖: Android
Time of Update: 2018-12-06
//File指的是檔案路徑 private void openFile(File file){ Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //設定intent的Action屬性 intent.setAction(Intent.ACTION_VIEW); //擷取檔案file的MIME類型 String type =
Time of Update: 2018-12-06
在實際開發中,開發android軟體的過程需要不斷地進行測試。使用Junint測試架構,是正規Android開發的必用技術,在Junint中可以得到組件,可以類比發送事件和檢測程式處理的正確性。單元測試是嵌入到項目中;也可以作為一個單獨的項目爭對某個具體項目進行測試。 第一步:首先在AndroidManifest.xml中加入下面紅色代碼: <manifest
Time of Update: 2018-12-06
一、 在res/values 檔案下定義一個attrs.xml 檔案.代碼如下:<?xml version="1.0" encoding="utf-8"?><resources> <declare-styleable name="customView"> <attr name="android:textColor"/>//在自訂屬性中使用Android內建的屬性名稱字 <attr name="customte
Time of Update: 2018-12-06
1. 改變背景 在res/drawable下建立一個xml檔案: <?xml version="1.0" encoding="UTF-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android">//
Time of Update: 2018-12-06
方法一: 如果單純的傳遞List<String> 或者List<Integer>的話
Time of Update: 2018-12-06
配置NDK環境變數及產生so檔案:1、