自定义CalendarView(Hijri)

时间:2014-04-17 08:52:37

标签: android calendar calendarview hijri

我的应用程序是关于Hijri(伊斯兰)日历,但默认的android CalendarView是格里高利! 如何自定义Android日历视图?!

我需要这样的事情:

  

enter image description here

1 个答案:

答案 0 :(得分:4)

您好,访问所有给定的链接,希望能帮助您

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.wordpress.com/2013/07/21/how-to-create-custom-calendar-in-android/

6。http://w2davids.wordpress.com/android-simple-calendar/

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

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

当您访问以下内容时:

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

有关此项目的工作实现,请参阅示例/文件夹。

实施适当的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!
      }
    }

使用其中一个Builder类创建一个带有主题的PickerDialog

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

另外还有一个例子,你可以访问

https://github.com/roomorama/Caldroid

并使用如下

要在您的活动中嵌入caldroid片段,请使用以下代码:

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