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


Java TimePicker.setIs24HourView方法代码示例

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


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

示例1: onCreate

import android.widget.TimePicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_notificacoes);
    setTitle("Notificações");
    timePicker = (TimePicker) findViewById(R.id.timePicker);
    timePicker.setIs24HourView(true);
    findViewById(R.id.setAlarmButton).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            h = timePicker.getCurrentHour();
            m = timePicker.getCurrentMinute();
            startAlarm();
        }
    });
    findViewById(R.id.cancelAlarm).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            cancelAlarm();
        }
    });
}
 
开发者ID:jvbeltra,项目名称:JavaIsFun,代码行数:24,代码来源:Notificacoes.java

示例2: onCreate

import android.widget.TimePicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_time_selection);

    Bundle extras = getIntent().getExtras();
    setTitle(extras.getInt("title"));
    //noinspection ConstantConditions
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, extras.getInt("color"))));

    dtpTime = (TimePicker) findViewById(R.id.timePicker);
    dtpTime.setIs24HourView(true);
    timeSelection = GregorianCalendar.getInstance();
    timeSelection.setTimeInMillis(extras.getLong("date"));
    //noinspection deprecation
    dtpTime.setCurrentHour(timeSelection.get(Calendar.HOUR_OF_DAY));
    //noinspection deprecation
    dtpTime.setCurrentMinute(timeSelection.get(Calendar.MINUTE));
}
 
开发者ID:Baleine82,项目名称:TrainPonctuality,代码行数:20,代码来源:TimeSelectionActivity.java

示例3: onCreateDialogView

import android.widget.TimePicker; //导入方法依赖的package包/类
@Override
protected View onCreateDialogView() {

    TimePicker tp = new TimePicker(getContext());
    tp.setIs24HourView(DateFormat.is24HourFormat(getContext()));
    tp.setOnTimeChangedListener(this);
    originalHour = getHour();
    originalMinute = getMinute();
    if (originalHour >= 0 && originalMinute >= 0) {
        tp.setCurrentHour(originalHour);
        tp.setCurrentMinute(originalMinute);
    }

    return tp;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:16,代码来源:TimePickerPreference.java

示例4: pickTime

import android.widget.TimePicker; //导入方法依赖的package包/类
/**
 * 时间选择对话框
 *
 * @param con      上下文
 * @param title    标题
 * @param listener 选择事件
 * @param cal      默认时间
 */
public static void pickTime(Context con, String title, Calendar cal, final OnTimeSetListener listener) {
    LinearLayout ll = new LinearLayout(con);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    ll.setLayoutParams(layoutParams);
    ll.setOrientation(LinearLayout.VERTICAL);
    //添加一条线
    LinearLayout line = new LinearLayout(con);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1);
    line.setBackgroundColor(con.getResources().getColor(R.color.line));
    line.setLayoutParams(lp);
    ll.addView(line);
    //添加选择器控件
    final TimePicker timePicker = new TimePicker(con, null, themeId);
    timePicker.setLayoutParams(layoutParams);
    timePicker.setCurrentHour(cal.get(Calendar.HOUR_OF_DAY));
    timePicker.setCurrentMinute(cal.get(Calendar.MINUTE));
    timePicker.setIs24HourView(true);
    ll.addView(timePicker);
    QuickDialog.Builder builder = new QuickDialog.Builder(con);
    builder.setContentView(ll);
    builder.setTitle(title);
    builder.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            listener.onTimeSet(timePicker, timePicker.getCurrentHour(), timePicker.getCurrentMinute());
        }
    });
    builder.create().show();
}
 
开发者ID:quickhybrid,项目名称:quickhybrid-android,代码行数:39,代码来源:DialogUtil.java

示例5: init

import android.widget.TimePicker; //导入方法依赖的package包/类
private void init(){
	startTime = (TimePicker) findViewById(R.id.start_time);
	endTime = (TimePicker) findViewById(R.id.end_time);
	startTime.setIs24HourView(DateFormat.is24HourFormat(this));
	endTime.setIs24HourView(DateFormat.is24HourFormat(this));
	mSetTime = (Button)findViewById(R.id.bu_setTime);
	mMonday = (CheckBox)findViewById(R.id.cb_monday);
	mTuesday = (CheckBox)findViewById(R.id.cb_tuesday);
	mWednesday = (CheckBox)findViewById(R.id.cb_wednesday);
    mThursday = (CheckBox)findViewById(R.id.cb_thursday);
	mFriday = (CheckBox)findViewById(R.id.cb_friday);
	mSaturday = (CheckBox)findViewById(R.id.cb_saturday);
	mSunday = (CheckBox)findViewById(R.id.cb_sunday);
}
 
开发者ID:LuoLuo0101,项目名称:JPush,代码行数:15,代码来源:SettingActivity.java

示例6: onCreateContentView

import android.widget.TimePicker; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected View onCreateContentView(Bundle savedInstanceState) {

    picker = new TimePicker(getContext());

    if (savedInstanceState != null){
        picker.setCurrentHour(savedInstanceState.getInt(HOUR));
        picker.setCurrentMinute(savedInstanceState.getInt(MINUTE));

    } else {
        if (getArguments().containsKey(HOUR)) {
            picker.setCurrentHour(getArguments().getInt(HOUR));
        }
        if (getArguments().containsKey(MINUTE)) {
            picker.setCurrentMinute(getArguments().getInt(MINUTE));
        }
    }

    if (getArguments().containsKey(VIEW_24_HOUR)) {
        picker.setIs24HourView(getArguments().getBoolean(VIEW_24_HOUR));
    } else {
        picker.setIs24HourView(DateFormat.is24HourFormat(getContext())); // system default
    }
    picker.setOnTimeChangedListener(this);

    return picker;
}
 
开发者ID:eltos,项目名称:SimpleDialogFragments,代码行数:29,代码来源:SimpleTimeDialog.java

示例7: onCreateDialogView

import android.widget.TimePicker; //导入方法依赖的package包/类
@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;
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:11,代码来源:TimePreference.java

示例8: TimePreference

import android.widget.TimePicker; //导入方法依赖的package包/类
public TimePreference(Context context, AttributeSet attrs, int defStyleAttr){
    super(context, attrs, defStyleAttr);

    timePicker = new TimePicker(context);
    timePicker.setId(View.generateViewId());

    timePicker.setEnabled(true);
    timePicker.setIs24HourView(true);

    setDialogIcon(null);
    setPositiveButtonText(android.R.string.ok);
    setNegativeButtonText(android.R.string.cancel);
}
 
开发者ID:aumarbello,项目名称:WalkGraph,代码行数:14,代码来源:TimePreference.java

示例9: onCreateDialogView

import android.widget.TimePicker; //导入方法依赖的package包/类
@Override
protected View onCreateDialogView() {
    mPicker = new TimePicker(getContext());
    mPicker.setIs24HourView(mTimerMode || DateFormat.is24HourFormat(getContext()));
    return mPicker;
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:7,代码来源:TimePreference.java

示例10: onViewCreated

import android.widget.TimePicker; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    TimePicker timePicker = (TimePicker) view.findViewById(R.id.feature_time_picker);
    timePicker.setIs24HourView(true);

}
 
开发者ID:fendoudebb,项目名称:PlayAndroid,代码行数:7,代码来源:ClockFragment.java

示例11: onCreateDialogView

import android.widget.TimePicker; //导入方法依赖的package包/类
@Override
protected View onCreateDialogView() {
    picker = new TimePicker(getContext());
    picker.setIs24HourView(true);
    return (picker);
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:7,代码来源:TimePickerPreference.java


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