1

私はせいぜいアプリ開発の初心者です。これが、このことを理解しようと何日も試みてきた繰り返しの質問になる場合は申し訳ありません。

私が持っているのはカレンダーです (これはインターネットで見つけた例です)。私がやりたかったのは、仕事のスケジュールに合わせて色分けされたカレンダーを作成することでした。そのため、それを機能させるためにいくつかのものを追加し、いくつかの異なるドローアブルで外観を変更しました。すべてうまくいきました。イベントをスケジュールするために同じ日にGoogleカレンダーに移動する特定の日を選択するときに追加する方法を理解することさえできました. しかし、私の人生では、このジェスチャーの部分を理解することはできません。

そのため、以下に私のコードを提供します。うまくいけば、あなたの素晴らしい人のうちの1人が私にいくつかの指針を与えることができます. 私は近くにいると思うのが好きです。「次」と「前」が保存されたジェスチャーライブラリを構築し、これを作成した生フォルダーに入れました。現在、予測名をトーストするように設定していますが、トーストを実行していません。左または右にスワイプしたところに黄色い線が表示されます。最終的には、ジェスチャ メソッドの少し下の next および previous の onClick メソッドにあることを実行したいと考えています。

    package com.examples;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.gesture.Gesture;
import android.gesture.GestureLibraries;
import android.gesture.GestureLibrary;
import android.gesture.GestureOverlayView;
import android.gesture.GestureOverlayView.OnGesturePerformedListener;
import android.gesture.Prediction;
import android.graphics.Color;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.trhodes.workcalendar2.R;

public class SimpleCalendarViewActivity extends Activity implements
        OnClickListener, OnGesturePerformedListener {
    private static final String tag = "SimpleCalendarViewActivity";
    Button selectedDayMonthYearButton;
    private Button currentMonth;
    private ImageView prevMonth;
    private ImageView nextMonth;
    private GridView calendarView;
    private GridCellAdapter adapter;
    private Calendar _calendar;
    private int month, year;
    private static final String dateTemplate = "MMMM yyyy";
    GestureLibrary mLibrary;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.simple_calendar_view);
        // new GestureDetector(this, this);
        _calendar = Calendar.getInstance(Locale.getDefault());
        month = _calendar.get(Calendar.MONTH) + 1;
        year = _calendar.get(Calendar.YEAR);
        Log.d(tag, "Calendar Instance:= " + "Month: " + month + " " + "Year: "
                + year);

        selectedDayMonthYearButton = (Button) this
                .findViewById(R.id.selectedDayMonthYear);
        selectedDayMonthYearButton.setText("Selected: ");

        prevMonth = (ImageView) this.findViewById(R.id.prevMonth);
        prevMonth.setOnClickListener(this);

        currentMonth = (Button) this.findViewById(R.id.currentMonth);
        currentMonth.setText(DateFormat.format(dateTemplate,
                _calendar.getTime()));

        nextMonth = (ImageView) this.findViewById(R.id.nextMonth);
        nextMonth.setOnClickListener(this);

        calendarView = (GridView) this.findViewById(R.id.calendar);

        // Initialised
        adapter = new GridCellAdapter(getApplicationContext(),
                R.id.calendar_day_gridcell, month, year);
        adapter.notifyDataSetChanged();
        calendarView.setAdapter(adapter);


        GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures);
        gestures.addOnGesturePerformedListener(this);

        mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
        if (!mLibrary.load()) {
            finish();
        }
    }
    public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
        ArrayList<Prediction> predictions = mLibrary.recognize(gesture);

        // We want at least one prediction
        if (predictions.size() > 0 && predictions.get(0).score > 1.0
                && gesture.getStrokesCount() > 1) {
            String what = "";
            for (int i = 0; i < predictions.size(); i++) {
                if (predictions.get(i).name.equals("next")
                        || predictions.get(i).name.equals("previous")) {
                    what = predictions.get(i).name;
                    break;
                }
            }
            if(what.equals("next")){

//              Log.d(tag, "Setting Next Month in GridCellAdapter: " + "Month: "
//                      + month + " Year: " + year);
//              setGridCellAdapterToDate(month, year);
                Toast.makeText(this, what, Toast.LENGTH_LONG).show();


            }else if(what.equals("previous")){

//                  Log.d(tag, "Setting Prev Month in GridCellAdapter: " + "Month: "
//                          + month + " Year: " + year);
//                  setGridCellAdapterToDate(month, year);
                Toast.makeText(this, what, Toast.LENGTH_LONG).show();
                }}}


    /**
     * 
     * @param month
     * @param year
     */
    private void setGridCellAdapterToDate(int month, int year) {
        adapter = new GridCellAdapter(getApplicationContext(),
                R.id.calendar_day_gridcell, month, year);
        _calendar.set(year, month - 1, _calendar.get(Calendar.DAY_OF_MONTH));
        currentMonth.setText(DateFormat.format(dateTemplate,
                _calendar.getTime()));
        adapter.notifyDataSetChanged();
        calendarView.setAdapter(adapter);
    }

    @Override
    public void onClick(View v) {
        if (v == prevMonth) {
            if (month <= 1) {
                month = 12;
                year--;
            } else {
                month--;
            }
            Log.d(tag, "Setting Prev Month in GridCellAdapter: " + "Month: "
                    + month + " Year: " + year);
            setGridCellAdapterToDate(month, year);
            Toast.makeText(this, "Previous", Toast.LENGTH_LONG).show();
            return;
        }
        if (v == nextMonth) {
            if (month > 11) {
                month = 1;
                year++;
            } else {
                month++;
            }
            Log.d(tag, "Setting Next Month in GridCellAdapter: " + "Month: "
                    + month + " Year: " + year);
            setGridCellAdapterToDate(month, year);
            Toast.makeText(this, "Next", Toast.LENGTH_LONG).show();
            return;
        }

    }

    @Override
    public void onDestroy() {
        Log.d(tag, "Destroying View ...");
        super.onDestroy();
    }

    // ///////////////////////////////////////////////////////////////////////////////////////
    // Inner Class
    public class GridCellAdapter extends BaseAdapter implements OnClickListener {
        private static final String tag = "GridCellAdapter";
        private final Context _context;

        private final List<String> list;
        private static final int DAY_OFFSET = 1;
        private final String[] weekdays = new String[] { "Sun", "Mon", "Tue",
                "Wed", "Thu", "Fri", "Sat" };
        private final String[] months = { "January", "February", "March",
                "April", "May", "June", "July", "August", "September",
                "October", "November", "December" };
        private final int[] daysOfMonth = { 31, 28, 31, 30, 31, 30, 31, 31, 30,
                31, 30, 31 };
        private int daysInMonth;
        private int currentDayOfMonth;
        private int currentWeekDay;
        private Button gridcell;
        private TextView num_events_per_day;
        private final HashMap<String, Integer> eventsPerMonthMap;

        // Days in Current Month
        public GridCellAdapter(Context context, int textViewResourceId,
                int month, int year) {
            super();
            this._context = context;
            this.list = new ArrayList<String>();
            Log.d(tag, "==> Passed in Date FOR Month: " + month + " "
                    + "Year: " + year);
            Calendar calendar = Calendar.getInstance();
            setCurrentDayOfMonth(calendar.get(Calendar.DAY_OF_MONTH));
            setCurrentWeekDay(calendar.get(Calendar.DAY_OF_WEEK));
            // setCurrentMonth(calendar.get(Calendar.MONTH));
            Log.d(tag, "New Calendar:= " + calendar.getTime().toString());
            Log.d(tag, "CurrentDayOfWeek :" + getCurrentWeekDay());
            Log.d(tag, "CurrentDayOfMonth :" + getCurrentDayOfMonth());

            // Print Month
            printMonth(month, year);

            // Find Number of Events
            eventsPerMonthMap = findNumberOfEventsPerMonth(year, month);
        }

        private String getMonthAsString(int i) {
            return months[i];
        }

        private String getWeekDayAsString(int i) {
            return weekdays[i];
        }

        private int getNumberOfDaysOfMonth(int i) {
            return daysOfMonth[i];
        }

        public String getItem(int position) {
            return list.get(position);
        }

        @Override
        public int getCount() {
            return list.size();
        }

        /**
         * Prints Month
         * 
         * @param mm
         * @param yy
         */
        private void printMonth(int mm, int yy) {
            Log.d(tag, "==> printMonth: mm: " + mm + " " + "yy: " + yy);
            // The number of days to leave blank at
            // the start of this month.
            int trailingSpaces = 0;
            int daysInPrevMonth = 0;
            int prevMonth = 0;
            int prevYear = 0;
            int nextMonth = 0;
            int nextYear = 0;

            // ////////////////////////////////////////////////////
            // added this string to hold the results for which color workColor
            // will use
            // initialized with the word "clear" so string won't be empty
            String workColor = "clear";
            // /////////////////////////////////////////////////////

            int currentMonth = mm - 1;
            String currentMonthName = getMonthAsString(currentMonth);
            daysInMonth = getNumberOfDaysOfMonth(currentMonth);

            Log.d(tag, "Current Month: " + " " + currentMonthName + " having "
                    + daysInMonth + " days.");

            // Gregorian Calendar : MINUS 1, set to FIRST OF MONTH
            GregorianCalendar cal = new GregorianCalendar(yy, currentMonth, 1);
            Log.d(tag, "Gregorian Calendar:= " + cal.getTime().toString());

            if (currentMonth == 11) {
                prevMonth = currentMonth - 1;
                daysInPrevMonth = getNumberOfDaysOfMonth(prevMonth);
                nextMonth = 0;
                prevYear = yy;
                nextYear = yy + 1;
                Log.d(tag, "*->PrevYear: " + prevYear + " PrevMonth:"
                        + prevMonth + " NextMonth: " + nextMonth
                        + " NextYear: " + nextYear);
            } else if (currentMonth == 0) {
                prevMonth = 11;
                prevYear = yy - 1;
                nextYear = yy;
                daysInPrevMonth = getNumberOfDaysOfMonth(prevMonth);
                nextMonth = 1;
                Log.d(tag, "**--> PrevYear: " + prevYear + " PrevMonth:"
                        + prevMonth + " NextMonth: " + nextMonth
                        + " NextYear: " + nextYear);
            } else {
                prevMonth = currentMonth - 1;
                nextMonth = currentMonth + 1;
                nextYear = yy;
                prevYear = yy;
                daysInPrevMonth = getNumberOfDaysOfMonth(prevMonth);
                Log.d(tag, "***---> PrevYear: " + prevYear + " PrevMonth:"
                        + prevMonth + " NextMonth: " + nextMonth
                        + " NextYear: " + nextYear);
            }

            // Compute how much to leave before before the first day of the
            // month.
            // getDay() returns 0 for Sunday.
            int currentWeekDay = cal.get(Calendar.DAY_OF_WEEK) - 1;
            trailingSpaces = currentWeekDay;

            Log.d(tag, "Week Day:" + currentWeekDay + " is "
                    + getWeekDayAsString(currentWeekDay));
            Log.d(tag, "No. Trailing space to Add: " + trailingSpaces);
            Log.d(tag, "No. of Days in Previous Month: " + daysInPrevMonth);

            if (cal.isLeapYear(cal.get(Calendar.YEAR)) && mm == 2) {
                ++daysInMonth;
            }

            // Trailing Month days
            for (int i = 0; i < trailingSpaces; i++) {
                Log.d(tag,
                        "PREV MONTH:= "
                                + prevMonth
                                + " => "
                                + getMonthAsString(prevMonth)
                                + " "
                                + String.valueOf((daysInPrevMonth
                                        - trailingSpaces + DAY_OFFSET)
                                        + i));

                // /////////////////////////////////////////////////////////////////
                // added to the line below this code -> + "-" + workColor <-
                // was -> list.add(String.valueOf((daysInPrevMonth -
                // trailingSpaces + DAY_OFFSET) + i) + "-GREY" + "-" +
                // getMonthAsString(prevMonth) + "-" + prevYear);
                // now -> list.add(String.valueOf((daysInPrevMonth -
                // trailingSpaces + DAY_OFFSET) + i) + "-GREY" + "-" +
                // getMonthAsString(prevMonth) + "-" + prevYear + "-" +
                // workColor);
                list.add(String
                        .valueOf((daysInPrevMonth - trailingSpaces + DAY_OFFSET)
                                + i)
                        + "-GREY"
                        + "-"
                        + getMonthAsString(prevMonth)
                        + "-"
                        + prevYear + "-" + workColor);
                // /////////////////////////////////////////////////////////////////////
            }

            // Current Month Days
            for (int i = 1; i <= daysInMonth; i++) {

                // ///////////////////////////////////////////////////////////////
                // reusing david's calendar code here and resetting the date
                // every time it loops thru the "for" statement
                cal.set(yy, currentMonth, i); // yy = year, currentMonth =
                                                // month, i = day
                // ////////////////////////////////////////////////////////////////

                // //////////////////////////////////////////////
                // you will need to implement some code here that will count the
                // number of weeks
                // from a set date. So roughly it would say
                // weeksFromSetDate = setDate (count the weeks to) todaysDate
                // then weeksFromSetDate would take the place of
                // "cal.get(Calendar.WEEK_OF_MONTH)" below
                // in the "if" statement. So, if weeksFromSetDate is an even
                // number it will
                // have no remainder and go to the related "switch" statement.
                // otherwise it will go to the lower "switch" statement below
                // "else".
                // Currently if you run the code it will only give you the
                // number of the week
                // within the given month. So the order of the work weeks from
                // month to month will be off.
                // This is just to give you an example to work with.
                // //////////////////////////////////////////////

                // int ordinalDay = cal.get(Calendar.DAY_OF_YEAR);
                // int weekDay = cal.get(Calendar.DAY_OF_WEEK) - 1; // Sunday =
                // 0
                // int numberOfWeeks = (ordinalDay - weekDay + 10) / 7;
                // System.out.println(numberOfWeeks);

                // ///////////////////////////////////////////////////////
                // added this "if" and "switch" statement
                // the "if" statement looks for odd or even weeks of the month
                // so, if the number of the week of the month has a zero
                // remainder after dividing by two is true go to switch
                // statement below

                if (cal.get(Calendar.WEEK_OF_YEAR) % 2 == 0) { // will find even
                                                                // week number
                    // the "switch" statement looks for the number of the day of
                    // the week
                    // so, if the number of the day of the week is 1, 2, 3, or 4
                    // then workColor will equal blue
                    // or , if the number of the day of the week is 5, 6, or 7
                    // then workColor will equal red
                    switch (cal.get(Calendar.DAY_OF_WEEK)) {
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                        workColor = "blue";
                        break;
                    case 5:
                    case 6:
                    case 7:
                        workColor = "red";
                        break;
                    }
                    // if the number of the week of the month has a remainder
                    // after dividing by two then go to switch statement below
                } else { // will be an odd week number
                            // this switch statement will do the same as the one
                            // above with the exception that the workColor will
                            // change
                    switch (cal.get(Calendar.DAY_OF_WEEK)) {
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                        workColor = "red";
                        break;
                    case 5:
                    case 6:
                    case 7:
                        workColor = "blue";
                        break;
                    }
                }

                Log.d(currentMonthName, String.valueOf(i) + " "
                        + getMonthAsString(currentMonth) + " " + yy + " "
                        + workColor);
                if (i == getCurrentDayOfMonth()) {

                    // /////////////////////////////////////////////////////////////////
                    // added to the line below this code -> + "-" + workColor <-
                    // was -> list.add(String.valueOf(i) + "-BLUE" + "-" +
                    // getMonthAsString(currentMonth) + "-" + yy);
                    //

                    // list.add(String.valueOf(i) + "-BLUE" + "-" +
                    // getMonthAsString(currentMonth) + "-" + yy + "-" +
                    // workColor);
                    list.add(String.valueOf(i) + "-GREEN" + "-"
                            + getMonthAsString(currentMonth) + "-" + yy + "-"
                            + workColor);
                    // ////////////////////////////////////////////////////////////////
                } else {

                    // /////////////////////////////////////////////////////////////////
                    // added to the line below this code -> + "-" + workColor <-
                    // was -> list.add(String.valueOf(i) + "-WHITE" + "-" +
                    // getMonthAsString(currentMonth) + "-" + yy);
                    // now -> list.add(String.valueOf(i) + "-WHITE" + "-" +
                    // getMonthAsString(currentMonth) + "-" + yy + "-" +
                    // workColor);
                    list.add(String.valueOf(i) + "-WHITE" + "-"
                            + getMonthAsString(currentMonth) + "-" + yy + "-"
                            + workColor);
                    // //////////////////////////////////////////////////////////////////
                }
            }

            // Leading Month days
            for (int i = 0; i < list.size() % 7; i++) {
                Log.d(tag, "NEXT MONTH:= " + getMonthAsString(nextMonth));

                // /////////////////////////////////////////////////////////////////
                // added to the line below this code -> + "-" + workColor <-
                // was -> list.add(String.valueOf(i + 1) + "-GREY" + "-" +
                // getMonthAsString(nextMonth) + "-" + nextYear);
                // now -> list.add(String.valueOf(i + 1) + "-GREY" + "-" +
                // getMonthAsString(nextMonth) + "-" + nextYear + "-" +
                // workColor);
                list.add(String.valueOf(i + 1) + "-GREY" + "-"
                        + getMonthAsString(nextMonth) + "-" + nextYear + "-"
                        + workColor);
                // /////////////////////////////////////////////////////////////////
            }
        }

        /**
         * NOTE: YOU NEED TO IMPLEMENT THIS PART Given the YEAR, MONTH, retrieve
         * ALL entries from a SQLite database for that month. Iterate over the
         * List of All entries, and get the dateCreated, which is converted into
         * day.
         * 
         * @param year
         * @param month
         * @return
         */
        private HashMap<String, Integer> findNumberOfEventsPerMonth(int year,
                int month) {
            HashMap<String, Integer> map = new HashMap<String, Integer>();
            // DateFormat dateFormatter2 = new DateFormat();

            // String day = dateFormatter2.format("dd", dateCreated).toString();

            // if (map.containsKey(day))
            // {
            // Integer val = (Integer) map.get(day) + 1;
            // map.put(day, val);
            // }
            // else
            // {
            // map.put(day, 1);
            // }
            return map;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View row = convertView;
            if (row == null) {
                LayoutInflater inflater = (LayoutInflater) _context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                row = inflater.inflate(R.layout.calendar_day_gridcell, parent,
                        false);
            }
            // Get a reference to the Day gridcell
            gridcell = (Button) row.findViewById(R.id.calendar_day_gridcell);
            gridcell.setOnClickListener(this);

            // ACCOUNT FOR SPACING

            Log.d(tag, "Current Day: " + getCurrentDayOfMonth());
            Log.d(tag, "day_color " + list.get(position).toString());
            String[] day_color = list.get(position).split("-");
            String theday = day_color[0];
            String themonth = day_color[2];
            String theyear = day_color[3];

            // ///////////////////////////////////////////////////////////////////////////////
            // added day_color[4] it holds the information on which work color
            // will be used in this method
            String theworkcolor = day_color[4]; // theworkcolor will be the
                                                // string that holds it
            // /////////////////////////////////////////////////////////////////////////////////

            if ((!eventsPerMonthMap.isEmpty()) && (eventsPerMonthMap != null)) {
                if (eventsPerMonthMap.containsKey(theday)) {
                    num_events_per_day = (TextView) row
                            .findViewById(R.id.num_events_per_day);
                    Integer numEvents = (Integer) eventsPerMonthMap.get(theday);
                    num_events_per_day.setText(numEvents.toString());
                }
            }

            // Set the Day GridCell
            gridcell.setText(theday);
            gridcell.setTag(themonth + "/" + theday + "/" + theyear);
            Log.d(tag, "Setting GridCell " + themonth + "/" + theday + "/"
                    + theyear);

            if (day_color[1].equals("GREY")) {
                gridcell.setTextColor(Color.LTGRAY);
            }

            if (day_color[1].equals("WHITE"))

                // added this if statement below to check if theworkcolor is
                // equal to "red"
                if (theworkcolor.equalsIgnoreCase("red")) {
                    // if theworkcolor equals "red" then make the text for the
                    // day red
                    gridcell.setTextColor(Color.RED);
                    // if not make it the text for the day blue
                } else {
                    gridcell.setTextColor(Color.BLUE);
                }
            // //////////////////////////////////////////////////////////////////

            if (day_color[1].equals("GREEN")) {
                if (theworkcolor.equalsIgnoreCase("red")) {
                    // if theworkcolor equals "red" then make the text for the
                    // day red
                    gridcell.setTextColor(Color.RED);
                    // if not make it the text for the day blue
                } else {
                    gridcell.setTextColor(Color.BLUE);
                }

                if (day_color[1].equals("GREEN")) {
                    Calendar cal = Calendar.getInstance();// <== These 2 lines
                                                            // highlight current
                                                            // day of
                    if ((cal.get(Calendar.MONTH) + 1) == month)// <== current
                                                                // month
                                                                // only.

                        gridcell.setBackgroundResource(R.drawable.current_day);
                }
            }
            return row;
        }

        // Section below opens google calendar and puts the same date as date
        @SuppressLint("SimpleDateFormat")
        // pressed
        @Override
        public void onClick(View view) {
            String date_month_year = (String) view.getTag();
            Date startdate = null;

            try {

                startdate = new SimpleDateFormat("MMM/dd/yyyy")
                        .parse(date_month_year);

            } catch (ParseException e) {
                e.printStackTrace();
            }
            Intent intent = new Intent(Intent.ACTION_EDIT);
            intent.setType("vnd.android.cursor.item/event");
            // String eventStartInMillis = (String) date_month_year;
            intent.putExtra("beginTime", startdate.getTime());
            String eventEndInMillis = null;
            intent.putExtra("endTime", eventEndInMillis);
            startActivity(intent);

        }

        public int getCurrentDayOfMonth() {
            return currentDayOfMonth;
        }

        private void setCurrentDayOfMonth(int currentDayOfMonth) {
            this.currentDayOfMonth = currentDayOfMonth;
        }

        public void setCurrentWeekDay(int currentWeekDay) {
            this.currentWeekDay = currentWeekDay;
        }

        public int getCurrentWeekDay() {
            return currentWeekDay;
        }

    }
}

これが役立つ場合は、ここに私のxmlもあります。私はこれを正しく設定したと信じています。

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/bg"
    android:orientation="vertical" >

<Button
    android:id="@+id/selectedDayMonthYear"
    android:layout_width="wrap_content"
    android:layout_height="20dp"
    android:layout_gravity="center"
    android:background="@drawable/calendar_top_header"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:visibility="invisible"
    android:textColor="#FFFFFF" >

    </Button>
        <Button
            android:id="@+id/currentMonth"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/calendar_bar"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#4682B4" >

        </Button>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" >

        <ImageView
            android:id="@+id/calendarheader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:src="@drawable/blue_bg_with_text" >
        </ImageView>
    </LinearLayout>
<LinearLayout 
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <android.gesture.GestureOverlayView
                android:id="@+id/gestures" android:layout_width="fill_parent"
                android:layout_height="fill_parent" android:gestureStrokeType="multiple"
                android:eventsInterceptionEnabled="true" android:orientation="vertical">

    <GridView
        android:id="@+id/calendar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:listSelector="@android:color/transparent"
        android:numColumns="7"
        android:stretchMode="columnWidth" >
    </GridView>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:layout_gravity="bottom|center_vertical"
        android:gravity="bottom"
        android:orientation="horizontal" >

        <ImageView
            android:id="@+id/prevMonth"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.30"
            android:src="@drawable/calendar_left_arrow_selector" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_vertical|center"
            android:layout_weight="0.66"
            android:gravity="center"
            android:text="Press any day to schedule an event"
            android:textColor="#4682B4" />

        <ImageView
            android:id="@+id/nextMonth"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_weight="0.30"
            android:src="@drawable/calendar_right_arrow_selector" />

    </LinearLayout>
</android.gesture.GestureOverlayView>
</LinearLayout>
</LinearLayout>

事前にお時間をいただきありがとうございました。私が得ることができるどんな助けも大歓迎です。私の質問で十分に明確だったことを願っています。

4

2 に答える 2

2

わかりました、これが私が思いついた解決策です。私は、助けが必要な次の人がこの方法で投稿できるようにしたかったのです。マキシム・エフィモフの反応に感謝し、正しい方向に進むことができました。また、このYouTubeビデオも私を大いに助けてくれましたGestureOverlayViewチュートリアル

だからここに私の作業コードがあります:

package com.examples;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.gesture.Gesture;
import android.gesture.GestureLibraries;
import android.gesture.GestureLibrary;
import android.gesture.GestureOverlayView;
import android.gesture.GestureOverlayView.OnGesturePerformedListener;
import android.gesture.Prediction;
import android.graphics.Color;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import com.trhodes.workcalendar2.R;

public class SimpleCalendarViewActivity extends Activity implements
        OnClickListener, OnGesturePerformedListener {
    private static final String tag = "SimpleCalendarViewActivity";
    Button selectedDayMonthYearButton;
    private Button currentMonth;
    private ImageView prevMonth;
    private ImageView nextMonth;
    private GridView calendarView;
    private GridCellAdapter adapter;
    private Calendar _calendar;
    private int month, year;
    private static final String dateTemplate = "MMMM yyyy";
    private GestureLibrary mLibrary;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        GestureOverlayView gestureOverlayView = new GestureOverlayView(this);
        View inflate = getLayoutInflater().inflate(
                R.layout.simple_calendar_view, null);
        gestureOverlayView.addView(inflate);
        gestureOverlayView.addOnGesturePerformedListener(this);
        gestureOverlayView.setGestureColor(Color.TRANSPARENT);
        gestureOverlayView.setUncertainGestureColor(Color.TRANSPARENT);
        // speeds up the reaction time a little
        gestureOverlayView.setFadeOffset(0);
        gestureOverlayView.setHapticFeedbackEnabled(true);
        mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
        if (!mLibrary.load()) {
            finish();
        }

        setContentView(gestureOverlayView);

        _calendar = Calendar.getInstance(Locale.getDefault());
        month = _calendar.get(Calendar.MONTH) + 1;
        year = _calendar.get(Calendar.YEAR);
        Log.d(tag, "Calendar Instance:= " + "Month: " + month + " " + "Year: "
                + year);

        selectedDayMonthYearButton = (Button) this
                .findViewById(R.id.selectedDayMonthYear);
        selectedDayMonthYearButton.setText("Selected: ");

        prevMonth = (ImageView) this.findViewById(R.id.prevMonth);
        prevMonth.setOnClickListener(this);

        currentMonth = (Button) this.findViewById(R.id.currentMonth);
        currentMonth.setText(DateFormat.format(dateTemplate,
                _calendar.getTime()));

        nextMonth = (ImageView) this.findViewById(R.id.nextMonth);
        nextMonth.setOnClickListener(this);

        calendarView = (GridView) this.findViewById(R.id.calendar);

        // Initialised
        adapter = new GridCellAdapter(getApplicationContext(),
                R.id.calendar_day_gridcell, month, year);
        adapter.notifyDataSetChanged();
        calendarView.setAdapter(adapter);

    }

    public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
        ArrayList<Prediction> predictions = mLibrary.recognize(gesture);
        for (Prediction prediction : predictions) {
            if (prediction.name.equals("next")) {

                if (month > 11) {
                    month = 1;
                    year++;
                } else {
                    month++;
                }
                Log.d(tag, "Setting Next Month in GridCellAdapter: "
                        + "Month: " + month + " Year: " + year);
                setGridCellAdapterToDate(month, year);
                return;
            } else {
                if (prediction.name.equals("previous")) {

                    if (month <= 1) {
                        month = 12;
                        year--;
                    } else {
                        month--;
                    }
                    Log.d(tag, "Setting Prev Month in GridCellAdapter: "
                            + "Month: " + month + " Year: " + year);
                    setGridCellAdapterToDate(month, year);
                    return;
                }
            }

        }

    }

    /**
     * 
     * @param month
     * @param year
     */
    private void setGridCellAdapterToDate(int month, int year) {
        adapter = new GridCellAdapter(getApplicationContext(),
                R.id.calendar_day_gridcell, month, year);
        _calendar.set(year, month - 1, _calendar.get(Calendar.DAY_OF_MONTH));
        currentMonth.setText(DateFormat.format(dateTemplate,
                _calendar.getTime()));
        adapter.notifyDataSetChanged();
        calendarView.setAdapter(adapter);
    }

    @Override
    public void onClick(View v) {
        if (v == prevMonth) {
            if (month <= 1) {
                month = 12;
                year--;
            } else {
                month--;
            }
            Log.d(tag, "Setting Prev Month in GridCellAdapter: " + "Month: "
                    + month + " Year: " + year);
            setGridCellAdapterToDate(month, year);

            return;
        }
        if (v == nextMonth) {
            if (month > 11) {
                month = 1;
                year++;
            } else {
                month++;
            }
            Log.d(tag, "Setting Next Month in GridCellAdapter: " + "Month: "
                    + month + " Year: " + year);
            setGridCellAdapterToDate(month, year);

            return;
        }

    }

    @Override
    public void onDestroy() {
        Log.d(tag, "Destroying View ...");
        super.onDestroy();
    }

    // ///////////////////////////////////////////////////////////////////////////////////////
    // Inner Class
    public class GridCellAdapter extends BaseAdapter implements OnClickListener {
        private static final String tag = "GridCellAdapter";
        private final Context _context;

        private final List<String> list;
        private static final int DAY_OFFSET = 1;
        private final String[] weekdays = new String[] { "Sun", "Mon", "Tue",
                "Wed", "Thu", "Fri", "Sat" };
        private final String[] months = { "January", "February", "March",
                "April", "May", "June", "July", "August", "September",
                "October", "November", "December" };
        private final int[] daysOfMonth = { 31, 28, 31, 30, 31, 30, 31, 31, 30,
                31, 30, 31 };
        private int daysInMonth;
        private int currentDayOfMonth;
        private int currentWeekDay;
        private Button gridcell;
        private TextView num_events_per_day;
        private final HashMap<String, Integer> eventsPerMonthMap;

        // Days in Current Month
        public GridCellAdapter(Context context, int textViewResourceId,
                int month, int year) {
            super();
            this._context = context;
            this.list = new ArrayList<String>();
            Log.d(tag, "==> Passed in Date FOR Month: " + month + " "
                    + "Year: " + year);
            Calendar calendar = Calendar.getInstance();
            setCurrentDayOfMonth(calendar.get(Calendar.DAY_OF_MONTH));
            setCurrentWeekDay(calendar.get(Calendar.DAY_OF_WEEK));
            // setCurrentMonth(calendar.get(Calendar.MONTH));
            Log.d(tag, "New Calendar:= " + calendar.getTime().toString());
            Log.d(tag, "CurrentDayOfWeek :" + getCurrentWeekDay());
            Log.d(tag, "CurrentDayOfMonth :" + getCurrentDayOfMonth());

            // Print Month
            printMonth(month, year);

            // Find Number of Events
            eventsPerMonthMap = findNumberOfEventsPerMonth(year, month);
        }

        private String getMonthAsString(int i) {
            return months[i];
        }

        private String getWeekDayAsString(int i) {
            return weekdays[i];
        }

        private int getNumberOfDaysOfMonth(int i) {
            return daysOfMonth[i];
        }

        public String getItem(int position) {
            return list.get(position);
        }

        @Override
        public int getCount() {
            return list.size();
        }

        /**
         * Prints Month
         * 
         * @param mm
         * @param yy
         */
        private void printMonth(int mm, int yy) {
            Log.d(tag, "==> printMonth: mm: " + mm + " " + "yy: " + yy);
            // The number of days to leave blank at
            // the start of this month.
            int trailingSpaces = 0;
            int daysInPrevMonth = 0;
            int prevMonth = 0;
            int prevYear = 0;
            int nextMonth = 0;
            int nextYear = 0;

            // ////////////////////////////////////////////////////
            // added this string to hold the results for which color workColor
            // will use
            // initialized with the word "clear" so string won't be empty
            String workColor = "clear";
            // /////////////////////////////////////////////////////

            int currentMonth = mm - 1;
            String currentMonthName = getMonthAsString(currentMonth);
            daysInMonth = getNumberOfDaysOfMonth(currentMonth);

            Log.d(tag, "Current Month: " + " " + currentMonthName + " having "
                    + daysInMonth + " days.");

            // Gregorian Calendar : MINUS 1, set to FIRST OF MONTH
            GregorianCalendar cal = new GregorianCalendar(yy, currentMonth, 1);
            Log.d(tag, "Gregorian Calendar:= " + cal.getTime().toString());

            if (currentMonth == 11) {
                prevMonth = currentMonth - 1;
                daysInPrevMonth = getNumberOfDaysOfMonth(prevMonth);
                nextMonth = 0;
                prevYear = yy;
                nextYear = yy + 1;
                Log.d(tag, "*->PrevYear: " + prevYear + " PrevMonth:"
                        + prevMonth + " NextMonth: " + nextMonth
                        + " NextYear: " + nextYear);
            } else if (currentMonth == 0) {
                prevMonth = 11;
                prevYear = yy - 1;
                nextYear = yy;
                daysInPrevMonth = getNumberOfDaysOfMonth(prevMonth);
                nextMonth = 1;
                Log.d(tag, "**--> PrevYear: " + prevYear + " PrevMonth:"
                        + prevMonth + " NextMonth: " + nextMonth
                        + " NextYear: " + nextYear);
            } else {
                prevMonth = currentMonth - 1;
                nextMonth = currentMonth + 1;
                nextYear = yy;
                prevYear = yy;
                daysInPrevMonth = getNumberOfDaysOfMonth(prevMonth);
                Log.d(tag, "***---> PrevYear: " + prevYear + " PrevMonth:"
                        + prevMonth + " NextMonth: " + nextMonth
                        + " NextYear: " + nextYear);
            }

            // Compute how much to leave before before the first day of the
            // month.
            // getDay() returns 0 for Sunday.
            int currentWeekDay = cal.get(Calendar.DAY_OF_WEEK) - 1;
            trailingSpaces = currentWeekDay;

            Log.d(tag, "Week Day:" + currentWeekDay + " is "
                    + getWeekDayAsString(currentWeekDay));
            Log.d(tag, "No. Trailing space to Add: " + trailingSpaces);
            Log.d(tag, "No. of Days in Previous Month: " + daysInPrevMonth);

            if (cal.isLeapYear(cal.get(Calendar.YEAR)) && mm == 2) {
                ++daysInMonth;
            }

            // Trailing Month days
            for (int i = 0; i < trailingSpaces; i++) {
                Log.d(tag,
                        "PREV MONTH:= "
                                + prevMonth
                                + " => "
                                + getMonthAsString(prevMonth)
                                + " "
                                + String.valueOf((daysInPrevMonth
                                        - trailingSpaces + DAY_OFFSET)
                                        + i));

                // /////////////////////////////////////////////////////////////////
                // added to the line below this code -> + "-" + workColor <-
                // was -> list.add(String.valueOf((daysInPrevMonth -
                // trailingSpaces + DAY_OFFSET) + i) + "-GREY" + "-" +
                // getMonthAsString(prevMonth) + "-" + prevYear);
                // now -> list.add(String.valueOf((daysInPrevMonth -
                // trailingSpaces + DAY_OFFSET) + i) + "-GREY" + "-" +
                // getMonthAsString(prevMonth) + "-" + prevYear + "-" +
                // workColor);
                list.add(String
                        .valueOf((daysInPrevMonth - trailingSpaces + DAY_OFFSET)
                                + i)
                        + "-GREY"
                        + "-"
                        + getMonthAsString(prevMonth)
                        + "-"
                        + prevYear + "-" + workColor);
                // /////////////////////////////////////////////////////////////////////
            }

            // Current Month Days
            for (int i = 1; i <= daysInMonth; i++) {

                // ///////////////////////////////////////////////////////////////
                // reusing david's calendar code here and resetting the date
                // every time it loops thru the "for" statement
                cal.set(yy, currentMonth, i); // yy = year, currentMonth =
                                                // month, i = day
                // ////////////////////////////////////////////////////////////////

                // //////////////////////////////////////////////
                // you will need to implement some code here that will count the
                // number of weeks
                // from a set date. So roughly it would say
                // weeksFromSetDate = setDate (count the weeks to) todaysDate
                // then weeksFromSetDate would take the place of
                // "cal.get(Calendar.WEEK_OF_MONTH)" below
                // in the "if" statement. So, if weeksFromSetDate is an even
                // number it will
                // have no remainder and go to the related "switch" statement.
                // otherwise it will go to the lower "switch" statement below
                // "else".
                // Currently if you run the code it will only give you the
                // number of the week
                // within the given month. So the order of the work weeks from
                // month to month will be off.
                // This is just to give you an example to work with.
                // //////////////////////////////////////////////

                // int ordinalDay = cal.get(Calendar.DAY_OF_YEAR);
                // int weekDay = cal.get(Calendar.DAY_OF_WEEK) - 1; // Sunday =
                // 0
                // int numberOfWeeks = (ordinalDay - weekDay + 10) / 7;
                // System.out.println(numberOfWeeks);

                // ///////////////////////////////////////////////////////
                // added this "if" and "switch" statement
                // the "if" statement looks for odd or even weeks of the month
                // so, if the number of the week of the month has a zero
                // remainder after dividing by two is true go to switch
                // statement below

                if (cal.get(Calendar.WEEK_OF_YEAR) % 2 == 0) { // will find even
                                                                // week number
                    // the "switch" statement looks for the number of the day of
                    // the week
                    // so, if the number of the day of the week is 1, 2, 3, or 4
                    // then workColor will equal blue
                    // or , if the number of the day of the week is 5, 6, or 7
                    // then workColor will equal red
                    switch (cal.get(Calendar.DAY_OF_WEEK)) {
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                        workColor = "blue";
                        break;
                    case 5:
                    case 6:
                    case 7:
                        workColor = "red";
                        break;
                    }
                    // if the number of the week of the month has a remainder
                    // after dividing by two then go to switch statement below
                } else { // will be an odd week number
                            // this switch statement will do the same as the one
                            // above with the exception that the workColor will
                            // change
                    switch (cal.get(Calendar.DAY_OF_WEEK)) {
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                        workColor = "red";
                        break;
                    case 5:
                    case 6:
                    case 7:
                        workColor = "blue";
                        break;
                    }
                }

                Log.d(currentMonthName, String.valueOf(i) + " "
                        + getMonthAsString(currentMonth) + " " + yy + " "
                        + workColor);
                if (i == getCurrentDayOfMonth()) {

                    // /////////////////////////////////////////////////////////////////
                    // added to the line below this code -> + "-" + workColor <-
                    // was -> list.add(String.valueOf(i) + "-BLUE" + "-" +
                    // getMonthAsString(currentMonth) + "-" + yy);
                    //

                    // list.add(String.valueOf(i) + "-BLUE" + "-" +
                    // getMonthAsString(currentMonth) + "-" + yy + "-" +
                    // workColor);
                    list.add(String.valueOf(i) + "-GREEN" + "-"
                            + getMonthAsString(currentMonth) + "-" + yy + "-"
                            + workColor);
                    // ////////////////////////////////////////////////////////////////
                } else {

                    // /////////////////////////////////////////////////////////////////
                    // added to the line below this code -> + "-" + workColor <-
                    // was -> list.add(String.valueOf(i) + "-WHITE" + "-" +
                    // getMonthAsString(currentMonth) + "-" + yy);
                    // now -> list.add(String.valueOf(i) + "-WHITE" + "-" +
                    // getMonthAsString(currentMonth) + "-" + yy + "-" +
                    // workColor);
                    list.add(String.valueOf(i) + "-WHITE" + "-"
                            + getMonthAsString(currentMonth) + "-" + yy + "-"
                            + workColor);
                    // //////////////////////////////////////////////////////////////////
                }
            }

            // Leading Month days
            for (int i = 0; i < list.size() % 7; i++) {
                Log.d(tag, "NEXT MONTH:= " + getMonthAsString(nextMonth));

                // /////////////////////////////////////////////////////////////////
                // added to the line below this code -> + "-" + workColor <-
                // was -> list.add(String.valueOf(i + 1) + "-GREY" + "-" +
                // getMonthAsString(nextMonth) + "-" + nextYear);
                // now -> list.add(String.valueOf(i + 1) + "-GREY" + "-" +
                // getMonthAsString(nextMonth) + "-" + nextYear + "-" +
                // workColor);
                list.add(String.valueOf(i + 1) + "-GREY" + "-"
                        + getMonthAsString(nextMonth) + "-" + nextYear + "-"
                        + workColor);
                // /////////////////////////////////////////////////////////////////
            }
        }

        /**
         * NOTE: YOU NEED TO IMPLEMENT THIS PART Given the YEAR, MONTH, retrieve
         * ALL entries from a SQLite database for that month. Iterate over the
         * List of All entries, and get the dateCreated, which is converted into
         * day.
         * 
         * @param year
         * @param month
         * @return
         */
        private HashMap<String, Integer> findNumberOfEventsPerMonth(int year,
                int month) {
            HashMap<String, Integer> map = new HashMap<String, Integer>();
            // DateFormat dateFormatter2 = new DateFormat();

            // String day = dateFormatter2.format("dd", dateCreated).toString();

            // if (map.containsKey(day))
            // {
            // Integer val = (Integer) map.get(day) + 1;
            // map.put(day, val);
            // }
            // else
            // {
            // map.put(day, 1);
            // }
            return map;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View row = convertView;
            if (row == null) {
                LayoutInflater inflater = (LayoutInflater) _context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                row = inflater.inflate(R.layout.calendar_day_gridcell, parent,
                        false);
            }
            // Get a reference to the Day gridcell
            gridcell = (Button) row.findViewById(R.id.calendar_day_gridcell);
            gridcell.setOnClickListener(this);

            // ACCOUNT FOR SPACING

            Log.d(tag, "Current Day: " + getCurrentDayOfMonth());
            Log.d(tag, "day_color " + list.get(position).toString());
            String[] day_color = list.get(position).split("-");
            String theday = day_color[0];
            String themonth = day_color[2];
            String theyear = day_color[3];

            // ///////////////////////////////////////////////////////////////////////////////
            // added day_color[4] it holds the information on which work color
            // will be used in this method
            String theworkcolor = day_color[4]; // theworkcolor will be the
                                                // string that holds it
            // /////////////////////////////////////////////////////////////////////////////////

            if ((!eventsPerMonthMap.isEmpty()) && (eventsPerMonthMap != null)) {
                if (eventsPerMonthMap.containsKey(theday)) {
                    num_events_per_day = (TextView) row
                            .findViewById(R.id.num_events_per_day);
                    Integer numEvents = (Integer) eventsPerMonthMap.get(theday);
                    num_events_per_day.setText(numEvents.toString());
                }
            }

            // Set the Day GridCell
            gridcell.setText(theday);
            gridcell.setTag(themonth + "/" + theday + "/" + theyear);
            Log.d(tag, "Setting GridCell " + themonth + "/" + theday + "/"
                    + theyear);

            if (day_color[1].equals("GREY")) {
                gridcell.setTextColor(Color.LTGRAY);
            }

            if (day_color[1].equals("WHITE"))

                // added this if statement below to check if theworkcolor is
                // equal to "red"
                if (theworkcolor.equalsIgnoreCase("red")) {
                    // if theworkcolor equals "red" then make the text for the
                    // day red
                    gridcell.setTextColor(Color.RED);
                    // if not make it the text for the day blue
                } else {
                    gridcell.setTextColor(Color.BLUE);
                }
            // //////////////////////////////////////////////////////////////////

            if (day_color[1].equals("GREEN")) {
                if (theworkcolor.equalsIgnoreCase("red")) {
                    // if theworkcolor equals "red" then make the text for the
                    // day red
                    gridcell.setTextColor(Color.RED);
                    // if not make it the text for the day blue
                } else {
                    gridcell.setTextColor(Color.BLUE);
                }

                if (day_color[1].equals("GREEN")) {
                    Calendar cal = Calendar.getInstance();// <== These 2 lines
                                                            // highlight current
                                                            // day of
                    if ((cal.get(Calendar.MONTH) + 1) == month)// <== current
                                                                // month
                                                                // only.

                        gridcell.setBackgroundResource(R.drawable.current_day);
                }
            }
            return row;
        }

        // Section below opens google calendar and puts the same date as date
        @SuppressLint("SimpleDateFormat")
        // pressed
        @Override
        public void onClick(View view) {
            String date_month_year = (String) view.getTag();
            Date startdate = null;

            try {

                startdate = new SimpleDateFormat("MMM/dd/yyyy")
                        .parse(date_month_year);

            } catch (ParseException e) {
                e.printStackTrace();
            }
            Intent intent = new Intent(Intent.ACTION_EDIT);
            intent.setType("vnd.android.cursor.item/event");
            // String eventStartInMillis = (String) date_month_year;
            intent.putExtra("beginTime", startdate.getTime());
            String eventEndInMillis = null;
            intent.putExtra("endTime", eventEndInMillis);
            startActivity(intent);

        }

        public int getCurrentDayOfMonth() {
            return currentDayOfMonth;
        }

        private void setCurrentDayOfMonth(int currentDayOfMonth) {
            this.currentDayOfMonth = currentDayOfMonth;
        }

        public void setCurrentWeekDay(int currentWeekDay) {
            this.currentWeekDay = currentWeekDay;
        }

        public int getCurrentWeekDay() {
            return currentWeekDay;
        }

    }
}

また、xml ファイルに GestureOverlayView を追加する必要はありませんでした。そのコードは必要ないと思うので含めません。GestureOverlayView 部分のない私の質問のように見えます。

于 2013-08-10T22:48:32.220 に答える