定制的Andr​​oid calendarView [英] Custom Android calendarView

查看:197
本文介绍了定制的Andr​​oid calendarView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找可在对话框像这样使用的CalendarView:

I am looking for a CalendarView that can be used in a dialog something like this:

我打算使用 android.widget.CalendarView ,但它可从API级别11这是一个问题,考虑到仍有大量的用户,采用了android 2.3.3 (但不是主要的人能放过那些组用户)。

I plan to use android.widget.CalendarView but it is available from API level 11. That's an issue considering there are still lot of users, using android 2.3.3 (but not a major one can let go those set of user).

以下哪些选项我应该使用?

Which of these options should I use?

1)可用,并利用它们相应的库

1) libraries that are available and use them accordingly.

2)自定义 android.widget.CalendarView

如果#2,然后是它有什么例子?

If #2, then are there any examples for it?

推荐答案

嗨访问的所有给定的联系,希望能帮助你。

Hi visit all given links, hope will help you

1 <一个href="https://github.com/inteist/android-better-time-picker">https://github.com/inteist/android-better-time-picker

2 <一个href="https://github.com/derekbrameyer/android-betterpickers">https://github.com/derekbrameyer/android-betterpickers

3 <一个href="http://www.androiddevelopersolutions.com/2013/05/android-calendar-sync.html">http://www.androiddevelopersolutions.com/2013/05/android-calendar-sync.html

4 <一href="http://www.androidviews.net/2013/04/extendedcalendarview/">http://www.androidviews.net/2013/04/extendedcalendarview/

5 <一href="http://abinashandroid.word$p$pss.com/2013/07/21/how-to-create-custom-calendar-in-android/">http://abinashandroid.word$p$pss.com/2013/07/21/how-to-create-custom-calendar-in-android/

6 <一href="http://w2davids.word$p$pss.com/android-simple-calendar/">http://w2davids.word$p$pss.com/android-simple-calendar/

7。 https://github.com/roomorama/Caldroid

8. <一href="https://github.com/flavienlaurent/datetimepicker">https://github.com/flavienlaurent/datetimepicker

当您将参观

<一个href="https://github.com/derekbrameyer/android-betterpickers">https://github.com/derekbrameyer/android-betterpickers

有关这个项目的执行工作看样品/文件夹。

For a working implementation of this project see the sample/ folder.

执行相应的处理程序回调:

Implement the appropriate Handler callbacks:

public class MyActivity extends Activity implements DatePickerDialogFragment.DatePickerDialogHandler {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    // ...
  }

  @Override
  public void onDialogDateSet(int year, int monthOfYear, int dayOfMonth) {
    // Do something with your date!
  }
}

使用该生​​成器类之一创建PickerDialog一个主题:

Use one of the Builder classes to create a PickerDialog with a theme:

DatePickerBuilder dpb = new DatePickerBuilder()
    .setFragmentManager(getSupportFragmentManager())
    .setStyleResId(R.style.BetterPickersDialogFragment);
dpb.show();

也是另一个例子,你可以访问

also for an another example you can visit

https://github.com/roomorama/Caldroid

和使用方法如下

要嵌入caldroid片段的活性,使用下面code:

To embed the caldroid fragment in your activity, use below code:

CaldroidFragment caldroidFragment = new CaldroidFragment();
Bundle args = new Bundle();
Calendar cal = Calendar.getInstance();
args.putInt(CaldroidFragment.MONTH, cal.get(Calendar.MONTH) + 1);
args.putInt(CaldroidFragment.YEAR, cal.get(Calendar.YEAR));
caldroidFragment.setArguments(args);

FragmentTransaction t = getSupportFragmentManager().beginTransaction();
t.replace(R.id.calendar1, caldroidFragment);
t.commit();

这篇关于定制的Andr​​oid calendarView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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