在 Alam kanak Week View Library 中高亮显示点击事件

Highlight the clicked event in Alam kanak Week View Library

我正在 app.i 中使用编译 'com.github.alamkanak:android-week-view:1.2.6' 库,希望在第一次单击时突出显示所选的 EmptyView。我确实覆盖了库的 onEmptyViewClicked(Calendar time) 但是通过调用 super.getView().setBackgroundDrawable(Drawable d);它改变了整个视图的背景,而不仅仅是空视图。单击时如何更改空视图的颜色(或突出显示)?如何实现?

这是我现在正在做的事情。

   @Override
public void onEmptyViewClicked(Calendar time) {

    GradientDrawable gd = new GradientDrawable(
            GradientDrawable.Orientation.TOP_BOTTOM,
            new int[] {0xFF616261,0xFF131313});
    gd.setCornerRadius(0f);

    getView().setBackground(gd);




}

好吧,在花时间搜索后我才知道 github 上已经有一个答案,但它没有与主分支合并。我想为日历的水平滚动提供范围,并在第一次点击时突出显示空事件。用户可以在第二个 tap.clone 上将事件添加到您的项目中/添加为模块。 https://github.com/mrwhite1/WeekViewLibrary 现在您可以使用

设置滚动范围
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE, -7);
    mWeekView.setMinDate(cal);

    Calendar c = Calendar.getInstance();
    c.add(Calendar.DATE,21);

    mWeekView.setMaxDate(c);

用于突出显示(然后添加)事件添加,

   mWeekView.setEmptyViewClickListener(this);

    // Set AddEvent Click Listener
    mWeekView.setAddEventClickListener(this);

    @Override
public void onEmptyViewClicked(Calendar time, Calendar tempTime, boolean clickedTwice) {

 //empty event clicked for the first time
}


@Override
public void onAddEventClicked(Calendar startTime, Calendar endTime) {

   // set your logic to add event (second tap)

}