android.widget.TimePicker.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中android.widget.TimePicker.<init>()方法的一些代码示例,展示了TimePicker.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimePicker.<init>()方法的具体详情如下:
包路径:android.widget.TimePicker
类名称:TimePicker
方法名:<init>

TimePicker.<init>介绍

暂无

代码示例

代码示例来源:origin: ankidroid/Anki-Android

@Override
protected View onCreateDialogView() {
  timePicker = new TimePicker(getContext());
  timePicker.setIs24HourView(true);
  return timePicker;
}

代码示例来源:origin: stackoverflow.com

TimePicker t = new TimePicker(this);

String formattedTime = "";
int hour = t.getCurrentHour();
String sHour = "00";
if(hour < 10){
 sHour = "0"+hour;
} else {
 sHour = String.valueOf(hour);
}

int minute = t.getCurrentMinute();
String sMinute = "00";
if(minute < 10){
 sMinute = "0"+minute;
} else {
 sMinute = String.valueOf(minute);
}

formattedTime = sHour+":"+sMinute+":"+"00"; // Sorry you can't get seconds from a TimePicker

代码示例来源:origin: stackoverflow.com

final TimePicker timePicker = new TimePicker(this);
 timePicker.setIs24HourView(true);
 timePicker.setCurrentHour(20);
 timePicker.setCurrentMinute(15);
 new AlertDialog.Builder(this)
     .setTitle("Test")
     .setPositiveButton(android.R.string.ok, new OnClickListener() {
       @Override
       public void onClick(DialogInterface dialog, int which) {
         Log.d("Picker", timePicker.getCurrentHour() + ":"
             + timePicker.getCurrentMinute());
       }
     })
     .setNegativeButton(android.R.string.cancel,
         new OnClickListener() {
           @Override
           public void onClick(DialogInterface dialog,
               int which) {
             Log.d("Picker", "Cancelled!");
           }
         }).setView(timePicker).show();

代码示例来源:origin: termux/termux-api

@Override
  TimePicker createWidgetView(AppCompatActivity activity) {
    return new TimePicker(activity);
  }
}

代码示例来源:origin: philliphsu/NumberPadTimePicker

@Override
  public void onOkButtonClick(NumberPadTimePicker view, int hourOfDay, int minute) {
    if (listener != null) {
      listener.onTimeSet(new TimePicker(context), hourOfDay, minute);
    }
  }
});

代码示例来源:origin: SecUSo/privacy-friendly-pedometer

@Override
protected View onCreateDialogView() {
  picker = new TimePicker(getContext());
  return picker;
}

代码示例来源:origin: lkorth/screen-notifications

@Override
protected View onCreateDialogView() {
  mPicker = new TimePicker(getContext());
  return mPicker;
}

代码示例来源:origin: stackoverflow.com

TimePicker view = new TimePicker(this);
View hour = view.findViewById(Resources.getSystem().getIdentifier("hour", "id", "android"));
View input = hour.findViewById(Resources.getSystem().getIdentifier("numberpicker_input", "id", "android"));
// then you can do this
input.setClickable(false);
input.setFocusable(false);
// or this
input.setVisibility(View.GONE);

代码示例来源:origin: emmaguy/clean-status-bar

@Override
protected View onCreateDialogView() {
  mTimePicker = new TimePicker(getContext());
  mTimePicker.setIs24HourView(true);
  return mTimePicker;
}

代码示例来源:origin: renyuneyun/Easer

@NonNull
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  timePicker = new TimePicker(getContext());
  timePicker.setIs24HourView(!SettingsHelper.use12HourClock(getContext()));
  return timePicker;
}

代码示例来源:origin: saki4510t/libcommon

@Override
protected View onCreateDialogView() {
  picker = new TimePicker(getContext());
  picker.setIs24HourView(true);
  return (picker);
}

代码示例来源:origin: saki4510t/libcommon

@Override
protected View onCreateDialogView() {
  picker = new TimePicker(getContext());
  picker.setIs24HourView(true);
  return (picker);
}

代码示例来源:origin: mathisdt/trackworktime

@Override
protected View onCreateDialogView() {
  picker = new TimePicker(getContext());
  picker.setIs24HourView(true);
  return (picker);
}

代码示例来源:origin: stackoverflow.com

final TimePicker timePicker = new TimePicker(this);
 timePicker.setIs24HourView(true);
 timePicker.setCurrentHour(20);
 timePicker.setCurrentMinute(15);
 new AlertDialog.Builder(this)
     .setTitle("Test")
     .setPositiveButton(android.R.string.ok, new OnClickListener() {
       @Override
       public void onClick(DialogInterface dialog, int which) {
         Log.d("Picker", timePicker.getCurrentHour() + ":"
             + timePicker.getCurrentMinute());
       }
     })
     .setNegativeButton(android.R.string.cancel,
         new OnClickListener() {
           @Override
           public void onClick(DialogInterface dialog,
               int which) {
             Log.d("Picker", "Cancelled!");
           }
         }).setView(timePicker).show();

代码示例来源:origin: stackoverflow.com

final TimePicker timePicker = new TimePicker(this);
 timePicker.setIs24HourView(true);
 timePicker.setCurrentHour(20);
 timePicker.setCurrentMinute(15);
 new AlertDialog.Builder(this)
     .setTitle("Test")
     .setPositiveButton(android.R.string.ok, new OnClickListener() {
       @Override
       public void onClick(DialogInterface dialog, int which) {
         Log.d("Picker", timePicker.getCurrentHour() + ":"
             + timePicker.getCurrentMinute());
       }
     })
     .setNegativeButton(android.R.string.cancel,
         new OnClickListener() {
           @Override
           public void onClick(DialogInterface dialog,
               int which) {
             Log.d("Picker", "Cancelled!");
           }
         }).setView(timePicker).show();

代码示例来源:origin: oliexdev/openScale

@Override
protected View getInputView() {
  TimePicker timePicker = new TimePicker(getContext());
  timePicker.setPadding(0, 15, 0, 0);
  Calendar cal = Calendar.getInstance();
  cal.setTime(time);
  timePicker.setCurrentHour(cal.get(Calendar.HOUR_OF_DAY));
  timePicker.setCurrentMinute(cal.get(Calendar.MINUTE));
  timePicker.setIs24HourView(android.text.format.DateFormat.is24HourFormat(getContext()));
  return timePicker;
}

代码示例来源:origin: oliexdev/openScale

@Override
protected View onCreateDialogView() {
  picker = new TimePicker(getContext());
  picker.setIs24HourView(android.text.format.DateFormat.is24HourFormat(getContext()));
  return picker;
}

代码示例来源:origin: lordi/tickmate

@Override
protected View onCreateDialogView() {
  picker = new TimePicker(getContext());
  // Set the picker to the system default 24 hour format setting
  picker.setIs24HourView(new DateFormat().is24HourFormat(this.getContext()));
  return picker;
}

代码示例来源:origin: dsolonenko/financisto

@Override
protected View onCreateDialogView() {
  Context context = getContext();
  TimePicker timePicker = new TimePicker(context);
  timePicker.setIs24HourView(is24HourFormat(context));
  timePicker.setOnTimeChangedListener(this);
  timePicker.setCurrentHour(getHour());
  timePicker.setCurrentMinute(getMinute());
  return timePicker;
}

代码示例来源:origin: GeoODK/collect

public TimeWidget(Context context, final FormEntryPrompt prompt) {
  super(context, prompt);
  mTimePicker = new TimePicker(getContext());
  mTimePicker.setId(QuestionWidget.newUniqueId());
  mTimePicker.setFocusable(!prompt.isReadOnly());

相关文章