android重力感應(yīng)開發(fā)之微信搖一搖功能
本實(shí)例主要使用了android的重力感應(yīng)功能并配合動(dòng)畫效果實(shí)現(xiàn),主要代碼如下:
第一:ShakeActivity主類:
package com.android.shake;
import java.io.IOException;
import java.util.HashMap;
import android.app.Activity;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.os.Handler;
import android.os.Vibrator;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.SlidingDrawer;
import android.widget.SlidingDrawer.OnDrawerCloseListener;
import android.widget.SlidingDrawer.OnDrawerOpenListener;
import android.widget.Toast;
import com.android.shake.ShakeListener.OnShakeListener;
public class ShakeActivity extends Activity{
ShakeListener mShakeListener = null;
Vibrator mVibrator;
private RelativeLayout mImgUp;
private RelativeLayout mImgDn;
private RelativeLayout mTitle;
private SlidingDrawer mDrawer;
private Button mDrawerBtn;
private SoundPool sndPool;
private HashMap<Integer, Integer> soundPoolMap = new HashMap<Integer, Integer>();
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.shake_activity);
//drawerSet ();//設(shè)置 drawer監(jiān)聽 切換 按鈕的方向
mVibrator = (Vibrator)getApplication().getSystemService(VIBRATOR_SERVICE);
mImgUp = (RelativeLayout) findViewById(R.id.shakeImgUp);
mImgDn = (RelativeLayout) findViewById(R.id.shakeImgDown);
mTitle = (RelativeLayout) findViewById(R.id.shake_title_bar);
mDrawer = (SlidingDrawer) findViewById(R.id.slidingDrawer1);
mDrawerBtn = (Button) findViewById(R.id.handle);
mDrawer.setOnDrawerOpenListener(new OnDrawerOpenListener()
{ public void onDrawerOpened()
{
mDrawerBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.shake_report_dragger_down));
TranslateAnimation titleup = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-1.0f);
titleup.setDuration(200);
titleup.setFillAfter(true);
mTitle.startAnimation(titleup);
}
});
/* 設(shè)定SlidingDrawer被關(guān)閉的事件處理 */
mDrawer.setOnDrawerCloseListener(new OnDrawerCloseListener()
{ public void onDrawerClosed()
{
mDrawerBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.shake_report_dragger_up));
TranslateAnimation titledn = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-1.0f,Animation.RELATIVE_TO_SELF,0f);
titledn.setDuration(200);
titledn.setFillAfter(false);
mTitle.startAnimation(titledn);
}
});
loadSound() ;
mShakeListener = new ShakeListener(this);
mShakeListener.setOnShakeListener(new OnShakeListener() {
public void onShake() {
//Toast.makeText(getApplicationContext(), "抱歉,暫時(shí)沒有找到在同一時(shí)刻搖一搖的人。\n再試一次吧!", Toast.LENGTH_SHORT).show();
startAnim(); //開始 搖一搖手掌動(dòng)畫
mShakeListener.stop();
sndPool.play(soundPoolMap.get(0), (float) 1, (float) 1, 0, 0,(float) 1.2);
new Handler().postDelayed(new Runnable(){
public void run(){
//Toast.makeText(getApplicationContext(), "抱歉,暫時(shí)沒有找到\n在同一時(shí)刻搖一搖的人。\n再試一次吧!", 500).setGravity(Gravity.CENTER,0,0).show();
sndPool.play(soundPoolMap.get(1), (float) 1, (float) 1, 0, 0,(float) 1.0);
Toast mtoast;
mtoast = Toast.makeText(getApplicationContext(),
"抱歉,暫時(shí)沒有找到\n在同一時(shí)刻搖一搖的人。\n再試一次吧!", 10);
//mtoast.setGravity(Gravity.CENTER, 0, 0);
mtoast.show();
mVibrator.cancel();
mShakeListener.start();
}
}, 2000);
}
});
}
private void loadSound() {
sndPool = new SoundPool(2, AudioManager.STREAM_SYSTEM, 5);
new Thread() {
public void run() {
try {
soundPoolMap.put(
0,
sndPool.load(getAssets().openFd(
"sound/shake_sound_male.mp3"), 1));
soundPoolMap.put(
1,
sndPool.load(getAssets().openFd(
"sound/shake_match.mp3"), 1));
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
public void startAnim () { //定義搖一搖動(dòng)畫動(dòng)畫
AnimationSet animup = new AnimationSet(true);
TranslateAnimation mytranslateanimup0 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-0.5f);
mytranslateanimup0.setDuration(1000);
TranslateAnimation mytranslateanimup1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,+0.5f);
mytranslateanimup1.setDuration(1000);
mytranslateanimup1.setStartOffset(1000);
animup.addAnimation(mytranslateanimup0);
animup.addAnimation(mytranslateanimup1);
mImgUp.startAnimation(animup);
AnimationSet animdn = new AnimationSet(true);
TranslateAnimation mytranslateanimdn0 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,+0.5f);
mytranslateanimdn0.setDuration(1000);
TranslateAnimation mytranslateanimdn1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-0.5f);
mytranslateanimdn1.setDuration(1000);
mytranslateanimdn1.setStartOffset(1000);
animdn.addAnimation(mytranslateanimdn0);
animdn.addAnimation(mytranslateanimdn1);
mImgDn.startAnimation(animdn);
}
public void startVibrato(){ //定義震動(dòng)
mVibrator.vibrate( new long[]{500,200,500,200}, -1); //第一個(gè){}里面是節(jié)奏數(shù)組, 第二個(gè)參數(shù)是重復(fù)次數(shù),-1為不重復(fù),非-1俄日從pattern的指定下標(biāo)開始重復(fù)
}
public void shake_activity_back(View v) { //標(biāo)題欄 返回按鈕
this.finish();
}
public void linshi(View v) { //標(biāo)題欄
startAnim();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mShakeListener != null) {
mShakeListener.stop();
}
}
}
代碼:
package com.android.shake;
import java.io.IOException;
import java.util.HashMap;
import android.app.Activity;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.os.Handler;
import android.os.Vibrator;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.SlidingDrawer;
import android.widget.SlidingDrawer.OnDrawerCloseListener;
import android.widget.SlidingDrawer.OnDrawerOpenListener;
import android.widget.Toast;
import com.android.shake.ShakeListener.OnShakeListener;
public class ShakeActivity extends Activity{
ShakeListener mShakeListener = null;
Vibrator mVibrator;
private RelativeLayout mImgUp;
private RelativeLayout mImgDn;
private RelativeLayout mTitle;
private SlidingDrawer mDrawer;
private Button mDrawerBtn;
private SoundPool sndPool;
private HashMap<Integer, Integer> soundPoolMap = new HashMap<Integer, Integer>();
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.shake_activity);
//drawerSet ();//設(shè)置 drawer監(jiān)聽 切換 按鈕的方向
mVibrator = (Vibrator)getApplication().getSystemService(VIBRATOR_SERVICE);
mImgUp = (RelativeLayout) findViewById(R.id.shakeImgUp);
mImgDn = (RelativeLayout) findViewById(R.id.shakeImgDown);
mTitle = (RelativeLayout) findViewById(R.id.shake_title_bar);
mDrawer = (SlidingDrawer) findViewById(R.id.slidingDrawer1);
mDrawerBtn = (Button) findViewById(R.id.handle);
mDrawer.setOnDrawerOpenListener(new OnDrawerOpenListener()
{ public void onDrawerOpened()
{
mDrawerBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.shake_report_dragger_down));
TranslateAnimation titleup = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-1.0f);
titleup.setDuration(200);
titleup.setFillAfter(true);
mTitle.startAnimation(titleup);
}
});
/* 設(shè)定SlidingDrawer被關(guān)閉的事件處理 */
mDrawer.setOnDrawerCloseListener(new OnDrawerCloseListener()
{ public void onDrawerClosed()
{
mDrawerBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.shake_report_dragger_up));
TranslateAnimation titledn = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-1.0f,Animation.RELATIVE_TO_SELF,0f);
titledn.setDuration(200);
titledn.setFillAfter(false);
mTitle.startAnimation(titledn);
}
});
loadSound() ;
mShakeListener = new ShakeListener(this);
mShakeListener.setOnShakeListener(new OnShakeListener() {
public void onShake() {
//Toast.makeText(getApplicationContext(), "抱歉,暫時(shí)沒有找到在同一時(shí)刻搖一搖的人。\n再試一次吧!", Toast.LENGTH_SHORT).show();
startAnim(); //開始 搖一搖手掌動(dòng)畫
mShakeListener.stop();
sndPool.play(soundPoolMap.get(0), (float) 1, (float) 1, 0, 0,(float) 1.2);
new Handler().postDelayed(new Runnable(){
public void run(){
//Toast.makeText(getApplicationContext(), "抱歉,暫時(shí)沒有找到\n在同一時(shí)刻搖一搖的人。\n再試一次吧!", 500).setGravity(Gravity.CENTER,0,0).show();
sndPool.play(soundPoolMap.get(1), (float) 1, (float) 1, 0, 0,(float) 1.0);
Toast mtoast;
mtoast = Toast.makeText(getApplicationContext(),
"抱歉,暫時(shí)沒有找到\n在同一時(shí)刻搖一搖的人。\n再試一次吧!", 10);
//mtoast.setGravity(Gravity.CENTER, 0, 0);
mtoast.show();
mVibrator.cancel();
mShakeListener.start();
}
}, 2000);
}
});
}
private void loadSound() {
sndPool = new SoundPool(2, AudioManager.STREAM_SYSTEM, 5);
new Thread() {
public void run() {
try {
soundPoolMap.put(
0,
sndPool.load(getAssets().openFd(
"sound/shake_sound_male.mp3"), 1));
soundPoolMap.put(
1,
sndPool.load(getAssets().openFd(
"sound/shake_match.mp3"), 1));
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
public void startAnim () { //定義搖一搖動(dòng)畫動(dòng)畫
AnimationSet animup = new AnimationSet(true);
TranslateAnimation mytranslateanimup0 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-0.5f);
mytranslateanimup0.setDuration(1000);
TranslateAnimation mytranslateanimup1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,+0.5f);
mytranslateanimup1.setDuration(1000);
mytranslateanimup1.setStartOffset(1000);
animup.addAnimation(mytranslateanimup0);
animup.addAnimation(mytranslateanimup1);
mImgUp.startAnimation(animup);
AnimationSet animdn = new AnimationSet(true);
TranslateAnimation mytranslateanimdn0 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,+0.5f);
mytranslateanimdn0.setDuration(1000);
TranslateAnimation mytranslateanimdn1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-0.5f);
mytranslateanimdn1.setDuration(1000);
mytranslateanimdn1.setStartOffset(1000);
animdn.addAnimation(mytranslateanimdn0);
animdn.addAnimation(mytranslateanimdn1);
mImgDn.startAnimation(animdn);
}
public void startVibrato(){ //定義震動(dòng)
mVibrator.vibrate( new long[]{500,200,500,200}, -1); //第一個(gè){}里面是節(jié)奏數(shù)組, 第二個(gè)參數(shù)是重復(fù)次數(shù),-1為不重復(fù),非-1俄日從pattern的指定下標(biāo)開始重復(fù)
}
public void shake_activity_back(View v) { //標(biāo)題欄 返回按鈕
this.finish();
}
public void linshi(View v) { //標(biāo)題欄
startAnim();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mShakeListener != null) {
mShakeListener.stop();
}
}
}
第二:一個(gè)檢測手機(jī)搖晃的監(jiān)聽器類ShakeListener ,代碼如下:
package com.android.shake;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.util.Log;
/**
* 一個(gè)檢測手機(jī)搖晃的監(jiān)聽器
*/
public class ShakeListener implements SensorEventListener {
// 速度閾值,當(dāng)搖晃速度達(dá)到這值后產(chǎn)生作用
private static final int SPEED_SHRESHOLD = 2000;
// 兩次檢測的時(shí)間間隔
private static final int UPTATE_INTERVAL_TIME = 70;
// 傳感器管理器
private SensorManager sensorManager;
// 傳感器
private Sensor sensor;
// 重力感應(yīng)監(jiān)聽器
private OnShakeListener onShakeListener;
// 上下文
private Context mContext;
// 手機(jī)上一個(gè)位置時(shí)重力感應(yīng)坐標(biāo)
private float lastX;
private float lastY;
private float lastZ;
// 上次檢測時(shí)間
private long lastUpdateTime;
// 構(gòu)造器
public ShakeListener(Context c) {
// 獲得監(jiān)聽對象
mContext = c;
start();
}
// 開始
public void start() {
// 獲得傳感器管理器
sensorManager = (SensorManager) mContext
.getSystemService(Context.SENSOR_SERVICE);
if (sensorManager != null) {
// 獲得重力傳感器
sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
}
// 注冊
if (sensor != null) {
sensorManager.registerListener(this, sensor,
SensorManager.SENSOR_DELAY_GAME);
}
}
// 停止檢測
public void stop() {
sensorManager.unregisterListener(this);
}
// 設(shè)置重力感應(yīng)監(jiān)聽器
public void setOnShakeListener(OnShakeListener listener) {
onShakeListener = listener;
}
// 重力感應(yīng)器感應(yīng)獲得變化數(shù)據(jù)
public void onSensorChanged(SensorEvent event) {
// 現(xiàn)在檢測時(shí)間
long currentUpdateTime = System.currentTimeMillis();
// 兩次檢測的時(shí)間間隔
long timeInterval = currentUpdateTime - lastUpdateTime;
// 判斷是否達(dá)到了檢測時(shí)間間隔
if (timeInterval < UPTATE_INTERVAL_TIME)
return;
// 現(xiàn)在的時(shí)間變成last時(shí)間
lastUpdateTime = currentUpdateTime;
// 獲得x,y,z坐標(biāo)
float x = event.values[0];
float y = event.values[1];
float z = event.values[2];
// 獲得x,y,z的變化值
float deltaX = x - lastX;
float deltaY = y - lastY;
float deltaZ = z - lastZ;
// 將現(xiàn)在的坐標(biāo)變成last坐標(biāo)
lastX = x;
lastY = y;
lastZ = z;
double speed = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ
* deltaZ)
/ timeInterval * 10000;
// 達(dá)到速度閥值,發(fā)出提示
if (speed >= SPEED_SHRESHOLD) {
onShakeListener.onShake();
}
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
// 搖晃監(jiān)聽接口
public interface OnShakeListener {
public void onShake();
}
}
代碼:
package com.android.shake;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.util.Log;
/**
* 一個(gè)檢測手機(jī)搖晃的監(jiān)聽器
*/
public class ShakeListener implements SensorEventListener {
// 速度閾值,當(dāng)搖晃速度達(dá)到這值后產(chǎn)生作用
private static final int SPEED_SHRESHOLD = 2000;
// 兩次檢測的時(shí)間間隔
private static final int UPTATE_INTERVAL_TIME = 70;
// 傳感器管理器
private SensorManager sensorManager;
// 傳感器
private Sensor sensor;
// 重力感應(yīng)監(jiān)聽器
private OnShakeListener onShakeListener;
// 上下文
private Context mContext;
// 手機(jī)上一個(gè)位置時(shí)重力感應(yīng)坐標(biāo)
private float lastX;
private float lastY;
private float lastZ;
// 上次檢測時(shí)間
private long lastUpdateTime;
// 構(gòu)造器
public ShakeListener(Context c) {
// 獲得監(jiān)聽對象
mContext = c;
start();
}
// 開始
public void start() {
// 獲得傳感器管理器
sensorManager = (SensorManager) mContext
.getSystemService(Context.SENSOR_SERVICE);
if (sensorManager != null) {
// 獲得重力傳感器
sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
}
// 注冊
if (sensor != null) {
sensorManager.registerListener(this, sensor,
SensorManager.SENSOR_DELAY_GAME);
}
}
// 停止檢測
public void stop() {
sensorManager.unregisterListener(this);
}
// 設(shè)置重力感應(yīng)監(jiān)聽器
public void setOnShakeListener(OnShakeListener listener) {
onShakeListener = listener;
}
// 重力感應(yīng)器感應(yīng)獲得變化數(shù)據(jù)
public void onSensorChanged(SensorEvent event) {
// 現(xiàn)在檢測時(shí)間
long currentUpdateTime = System.currentTimeMillis();
// 兩次檢測的時(shí)間間隔
long timeInterval = currentUpdateTime - lastUpdateTime;
// 判斷是否達(dá)到了檢測時(shí)間間隔
if (timeInterval < UPTATE_INTERVAL_TIME)
return;
// 現(xiàn)在的時(shí)間變成last時(shí)間
lastUpdateTime = currentUpdateTime;
// 獲得x,y,z坐標(biāo)
float x = event.values[0];
float y = event.values[1];
float z = event.values[2];
// 獲得x,y,z的變化值
float deltaX = x - lastX;
float deltaY = y - lastY;
float deltaZ = z - lastZ;
// 將現(xiàn)在的坐標(biāo)變成last坐標(biāo)
lastX = x;
lastY = y;
lastZ = z;
double speed = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ
* deltaZ)
/ timeInterval * 10000;
// 達(dá)到速度閥值,發(fā)出提示
if (speed >= SPEED_SHRESHOLD) {
onShakeListener.onShake();
}
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
// 搖晃監(jiān)聽接口
public interface OnShakeListener {
public void onShake();
}
}
第三:必須在AndroidManifest.xml中添加權(quán)限,否側(cè)搖動(dòng)時(shí)不能監(jiān)聽
<uses-permission android:name="android.hardware.sensor.accelerometer"/>
第四:效果圖:

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Android實(shí)現(xiàn)微信搖一搖功能
- Android編程使用加速度傳感器實(shí)現(xiàn)搖一搖功能及優(yōu)化的方法詳解
- Android實(shí)現(xiàn)iPhone晃動(dòng)撤銷輸入功能 Android仿微信搖一搖功能
- Android利用傳感器仿微信搖一搖功能
- Android實(shí)現(xiàn)搖一搖功能
- Android利用傳感器實(shí)現(xiàn)微信搖一搖功能
- Android 微信搖一搖功能實(shí)現(xiàn)詳細(xì)介紹
- android 類似微信的搖一搖功能實(shí)現(xiàn)思路及代碼
- Android實(shí)現(xiàn)搖一搖簡單功能
相關(guān)文章
Android通過ImageView設(shè)置手指滑動(dòng)控件縮放
這篇文章主要介紹了Android通過ImageView設(shè)置手指滑動(dòng)控件縮放效果,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-12-12
Flutter 使用fluro的轉(zhuǎn)場動(dòng)畫進(jìn)行頁面切換
在實(shí)際應(yīng)用中,我們常常會(huì)對不同的頁面采取不同的轉(zhuǎn)場動(dòng)畫,以提高頁面切換過程中的用戶體驗(yàn)。例如,微信的掃碼后在手機(jī)上確認(rèn)登錄頁面就是從底部彈出的,而大部分頁面的跳轉(zhuǎn)都是從右向左滑入。通過這種形式區(qū)分不同的轉(zhuǎn)場場景,從而給用戶更多的趣味性以提高用戶體驗(yàn)。2021-06-06
android:照片涂畫功能實(shí)現(xiàn)過程及原理詳解
這篇文章主要介紹了android:照片涂畫功能實(shí)現(xiàn)過程及原理,需要的朋友可以參考下2014-02-02
Android編程實(shí)現(xiàn)列表側(cè)滑刪除的方法詳解
這篇文章主要介紹了Android編程實(shí)現(xiàn)列表側(cè)滑刪除的方法,結(jié)合實(shí)例形式詳細(xì)分析了Android列表側(cè)滑刪除功能的原理與具體實(shí)現(xiàn)技巧,注釋中包含詳盡的說明,需要的朋友可以參考下2018-01-01
Android四大組件:Activity/Service/Broadcast/ContentProvider作用示例
Android是一種基于Linux,自由及開放源代碼的操作系統(tǒng),Android分為四個(gè)層,從高層到底層分別是應(yīng)用程序?qū)?、?yīng)用程序框架層、系統(tǒng)運(yùn)行庫層和Linux內(nèi)核層,Android有四大基本組件:Activity、Service服務(wù)、BroadcastReceiver廣播接收器、Content Provider內(nèi)容提供者2023-11-11

