我有一个数字时钟小部件。如何在显示时钟的textview中使用资产/字体中的自定义字体作为默认字体?
这是我的代码:
package android.tristan.widget.digiclock;
import java.util.Calendar;
import android.app.PendingIntent;
import android.app.Service;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import android.os.Vibrator;
import android.text.format.DateFormat;
import android.widget.RemoteViews;
public class DigiClock extends AppWidgetProvider {
@Override
public void onDisabled(Context context) {
super.onDisabled(context);
context.stopService(new Intent(context, UpdateService.class));
}
public void onReceive(Context context, Intent intent)
{
super.onReceive(context, intent);
if(intent.getAction().equals("android.tristan.widget.digiclock.CLICK"))
{
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(50);
final Intent alarmClockIntent = new Intent(Intent.ACTION_MAIN, null);
alarmClockIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final ComponentName cn = new ComponentName("com.android.deskclock", "com.android.deskclock.AlarmClock");
alarmClockIntent.setComponent(cn);
alarmClockIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(alarmClockIntent);
}
if(intent.getAction().equals("android.tristan.widget.digiclock.CLICK_2"))
}
}
守着一只汪
相关分类