定制的Andr​​oid calendarViewAndr、oid、calendarView

2023-09-12 10:47:53 作者:随心随缘不随便

我要寻找可在对话框像这样使用的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 https://github.com/inteist/android-better-time-picker

2 https://github.com/derekbrameyer/android-betterpickers

3 http://www.androiddevelopersolutions.com/2013/05/android-calendar-sync.html

4 http://www.androidviews.net/2013/04/extendedcalendarview/

5 http://abinashandroid.word$p$pss.com/2013/07/21/how-to-create-custom-calendar-in-android/

6 http://w2davids.word$p$pss.com/android-simple-calendar/

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

8. https://github.com/flavienlaurent/datetimepicker

当您将参观

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();