1

每个 Cell 都GridView包含许多项目,所以我使用ScrollView它。但是当我ScrollView在这个布局单元中实现时,GridView's setOnItemLongClickListener不工作???不要用户ScrollView,它运作良好。

这是我的单元格 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="170dp"
    android:background="@android:color/white"
    android:orientation="vertical" >

    <com.brightstar.groundtruth.custom.CustomTextView
        android:id="@+id/tv_day"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="16dp" />

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:id="@+id/scr_monthl_cell"
        android:visibility="visible" >

        <LinearLayout
            android:id="@+id/list_activities"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="5dp"
            android:orientation="vertical" >
        </LinearLayout>
    </ScrollView>

</LinearLayout>

这里是 setOnItemLongClickListener

gridView.setOnItemLongClickListener(new OnItemLongClickListener() {

            @Override
            public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
                    int arg2, long arg3) {
                if(mAdapterMonthly.getInMonth(arg2)){
                    int day = Integer.parseInt(mAdapterMonthly.getDay(arg2));
                    mDateCreated = CalendarUtils.setDayOfDateInMonth(day, mSelectDate);
                    if(checkSelDateInPlan(mDateCreated)){
                        List<CallCyclePlanModel> lstCallCycle = mCallCyclePlanHelper.getAllCallCyclePlan(mDateCreated, mPlanId);
                        addCallCycle(view, null, lstCallCycle, mDateCreated, false);
                    }else {
                        GeneralUtils.showAlertDialog(mContext, getString(R.string.title_validation_date_in_plan), getString(R.string.message_can_not_create_call_cycle));
                    }
                }
                return false;
            }
        });

任何人都可以帮助我,拜托!!

4

0 回答 0