当前位置: 首页>>代码示例>>Java>>正文


Java CheckBox.setTypeface方法代码示例

本文整理汇总了Java中android.widget.CheckBox.setTypeface方法的典型用法代码示例。如果您正苦于以下问题:Java CheckBox.setTypeface方法的具体用法?Java CheckBox.setTypeface怎么用?Java CheckBox.setTypeface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.CheckBox的用法示例。


在下文中一共展示了CheckBox.setTypeface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getView

import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
public View getView(final int position, View view, ViewGroup parent) {

  view = mFactory.inflate(R.layout.deskclock_alarm_time_elemento, parent, false);

  DigitalClock digitalClock =
      (DigitalClock) view.findViewById(R.id.digitalClock);
  digitalClock.setLive(false);

  final Alarm alarm = Alarms.alarmer.get(position);

  View indicator = view.findViewById(R.id.indicator);

  // Set the initial state of the clock "checkbox"
  final CheckBox clockOnOff =
      (CheckBox) indicator.findViewById(R.id.clock_onoff);
  clockOnOff.setChecked(alarm.enabled);
  clockOnOff.setTypeface(App.skrift_gibson);

  // Clicking outside the "checkbox" should also change the state.
  indicator.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
      clockOnOff.toggle();
      updateAlarm(clockOnOff.isChecked(), alarm);
    }
  });


  // set the alarm text
  final Calendar c = Calendar.getInstance();
  c.set(Calendar.HOUR_OF_DAY, alarm.hour);
  c.set(Calendar.MINUTE, alarm.minutes);
  digitalClock.updateTime(c);

  // Set the repeat text or leave it blank if it does not repeat.
  TextView daysOfWeekView =
      (TextView) digitalClock.findViewById(R.id.daysOfWeek);
  daysOfWeekView.setTypeface(App.skrift_gibson);
  final String daysOfWeekStr =
      alarm.daysOfWeek.toString(AlarmClock_akt.this, false);
  if (daysOfWeekStr != null && daysOfWeekStr.length() != 0) {
    daysOfWeekView.setText(daysOfWeekStr);
    daysOfWeekView.setVisibility(View.VISIBLE);
  } else {
    daysOfWeekView.setVisibility(View.GONE);
  }

  // Display the label
  TextView labelView =
      (TextView) view.findViewById(R.id.label);
  labelView.setTypeface(App.skrift_gibson);
  if (alarm.label != null && alarm.label.length() != 0) {
    labelView.setText(alarm.label);
    labelView.setVisibility(View.VISIBLE);
  } else {
    labelView.setVisibility(View.GONE);
  }
  ((TextView) view.findViewById(R.id.timeDisplay)).setTypeface(App.skrift_gibson);
  return view;
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:61,代码来源:AlarmClock_akt.java


注:本文中的android.widget.CheckBox.setTypeface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。