微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > 将keyguard默认的时间ClockView替换为digitalClock Appwidget

将keyguard默认的时间ClockView替换为digitalClock Appwidget

时间:10-02 整理:3721RD 点击:
1. 按如下方法修改KeyguardHostView.java中addDefaultStatusWidget():
private void addDefaultStatusWidget(int index) {
int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
mAppWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,
new
ComponentName("com.android.deskclock","com.android.alARMclock.DigitalAppWi
dgetProvider"));
AppWidgetProviderInfo appWidgetInfo =
mAppWidgetManager.getAppWidgetInfo(appWidgetId);
if (appWidgetInfo != null) {
AppWidgetHostView view = getAppWidgetHost().createView(mContext,
appWidgetId, appWidgetInfo);
addWidget(view, index);
Log.d(TAG,"keyguardHostView.addDefaultStatusWidget().appWidgetId="+appWidg
etId+"; pageIndex="+index+";"+"appWidgetInfo="+appWidgetInfo);
}
}
2. 如何替换为其他appWidget
只需要将上面bindAppWidgetIdIfAllowed()第二个参数ComponentName修改为对应
appWidget的ComponentName即可

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top