如何从Time Picker对话框中选择时间时添加Switchto listview

时间:2015-11-20 19:00:36

标签: android

当我从TimePicker对话框中选择时间时,如何添加切换按钮。 开关也应该在所选时间的同一行

    // Here, you set the data in your ListView
    list.setAdapter(adapter);

    tv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            // this line adds the data of your EditText and puts in your array
            TimePickerDialog tp=new TimePickerDialog(MainActivity.this, new TimePickerDialog.OnTimeSetListener() {
                @Override
                public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    arrayList.add(hourOfDay + ":" + minute);

                    // next thing you have to do is check if your adapter has changed
                    adapter.notifyDataSetChanged();
                }
            },10,00,true);
            tp.setTitle("Set time");
            tp.setButton(DialogInterface.BUTTON_POSITIVE, "OK", tp);
            tp.show();
        }
    });
}

0 个答案:

没有答案