求帮忙看看
public class MainActivity extends AppCompatActivity implements TimePicker.OnTimeChangedListener{ private TimePicker timePicker; private Calendar cal; private int year;//定义时间变量 private int month; private int day; private int hour; private int minute; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); timePicker = (TimePicker) findViewById(R.id.timePicker); cal = Calendar.getInstance();//获取时间信息 //获取年月日的信息 hour=cal.get(Calendar.HOUR); minute=cal.get(Calendar.MINUTE); setTitle(hour+":"+minute); timePicker.setOnTimeChangedListener(this); } @Override public void onTimeChanged(TimePicker view, int hourOfDay, int minute) { setTitle(hour +":"+ minute); }
为什么标题栏的时间和设置的时间的小时不同步