CalendarView今天最新产品Click [英] CalendarView today date item click

查看:227
本文介绍了CalendarView今天最新产品Click的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了很多在互联网上,我不能成功找到CalendarView正确的解决方案,单击今天的日期。

I searched a lot on the internet and I couldn't succeed to find correct solution for CalendarView click on today date.

我需要使用CalendarView事件的应用程序。 setOnDateChangeListener 工作好,一天的点击量。

I need to use CalendarView for events app. setOnDateChangeListener works good for other day clicks.

code:

CalendarView calendarView=(CalendarView) findViewById(R.id.calendarView1);
    calendarView.setOnDateChangeListener(new OnDateChangeListener() {

        @Override
        public void onSelectedDayChange(CalendarView view, int year, int month,
                int dayOfMonth) {
            Intent k = new Intent(GlavnaAktivnost.this, DatumDetalji.class);
            k.putExtra("godina", year);
            k.putExtra("mesec", month);
            k.putExtra("dan", dayOfMonth);
            startActivity(k);

        }
    });

我不的理解以及什么,我需要做的,什么是最好的解决方案呢? 我是体健找到堆栈答案是延长CalendarView或绑定点击用户界面,但我无法找到它的方法。你能给我一些例子吗?

I dont's understand well what I need to do and what is the best solution for this? Answers that I was abled to find on stack is to extend CalendarView or bind click on UI but I couldn't find a way with it. Can you give me some example?

TNX。

推荐答案

setOnDateChangeListener将不火,但OnGlobalLayoutListener会。 所以,如果你尝试: calendarView.getViewTreeObserver()addOnGlobalLayoutListener(新ViewTreeObserver.OnGlobalLayoutListener(){@覆盖     公共无效onGlobalLayout()     {     } });

setOnDateChangeListener will not fire, but OnGlobalLayoutListener will. So if you try: calendarView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){@Override public void onGlobalLayout() { } });

这篇关于CalendarView今天最新产品Click的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆