当我在布局单元中实现ScrollView时,java GridView的setOnItemLongClickListener不起作用(使用适配器)
GridView
的每个单元格都包含许多项,所以我使用ScrollView
来表示这一点。但是当我将ScrollView
实现到这个布局单元中时,GridView's
{ScrollView
,它运行良好
这是我的单元格xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:layout_width="fill_parent"
安卓:layout_height="170dp"
安卓:background="@安卓:color/white"
安卓:orientation="vertical" >
<com.brightstar.groundtruth.custom.CustomTextView
安卓:id="@+id/tv_day"
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:textSize="16dp" />
<ScrollView
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:id="@+id/scr_monthl_cell"
安卓:visibility="visible" >
<LinearLayout
安卓:id="@+id/list_activities"
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginLeft="5dp"
安卓:layout_marginTop="5dp"
安卓: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;
}
});
任何人都可以帮我,拜托
共 (0) 个答案