Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Android日历视图中突出显示多个日期_Android - Fatal编程技术网

如何在Android日历视图中突出显示多个日期

如何在Android日历视图中突出显示多个日期,android,Android,我正在开发一个android应用程序,我想在其中突出显示多个日期。我怎样才能用简单的方式做到这一点 好的,CalendarView不支持此功能,因为CalendarView的目的是允许用户选择日期。查看可能支持您所需功能的。 simpleCalendarView = (CalendarView) findViewById(R.id.simpleCalendarView); Drawable verticalBar = simpleCalendarView.getSelectedDateVerti

我正在开发一个android应用程序,我想在其中突出显示多个日期。我怎样才能用简单的方式做到这一点


好的,
CalendarView
不支持此功能,因为
CalendarView
的目的是允许用户选择日期。查看可能支持您所需功能的。
simpleCalendarView = (CalendarView) findViewById(R.id.simpleCalendarView);
Drawable verticalBar = simpleCalendarView.getSelectedDateVerticalBar();
simpleCalendarView.setFocusedMonthDateColor(Color.RED); // set the red color for the dates of  focused month
simpleCalendarView.setUnfocusedMonthDateColor(Color.BLUE); // set the yellow color for the dates of an unfocused month
simpleCalendarView.setSelectedWeekBackgroundColor(Color.RED); // red color for the selected week's background
simpleCalendarView.setWeekSeparatorLineColor(Color.GREEN); // green color for the week separator line
// perform setOnDateChangeListener event on CalendarView


simpleCalendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
    @Override
    public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) {
        // display the selected date by using a toast
        int y = year;
        int m = month + 1;
        int d = dayOfMonth;
        final String date = d + "/" + m + "/" + y;
        final ProgressDialog loading = ProgressDialog.show(Daily_Attendance.this, "Processing...", "Please wait...", false, false);

        StringRequest stringRequest = new StringRequest(Request.Method.POST, url3, new Response.Listener() {
            @Override
            public void onResponse(String response) {
                try {
                    Log.d("rr",response);
                    loading.dismiss();
                    JSONArray j = new JSONArray(response);
                    JSONObject jo = j.getJSONObject(0);
                    String res = jo.getString("result");
                    if (res.equals("true")) {
                        alert.setMessage("You Were Present on " + date)
                                .setPositiveButton("ok", new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        dialog.dismiss();
                                    }
                                })
                                .show();
                    }
                    if (res.equals("false")) {

                        alert.setMessage("You were Absent on " + date)
                                .setPositiveButton("ok", new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        dialog.dismiss();
                                    }
                                })
                                .show();
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }

            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {

            }
        }) 

        AppController.getInstance().addToRequestQueue(stringRequest);

    }
});