gridview item 设置为disenable
想把gridview中的某一个宫格设为disenable,我用的是SimpleAdapter,在oncreate()中 gridview.getAtChild(0).setEnable(false) 出现 crash,那位有办法 --------------------编程问答-------------------- so 深奥 --------------------编程问答-------------------- logcat报什么错误 --------------------编程问答-------------------- 报的错误:The application TestGridView (process test.TestGridView) has stopped unexceptedly.Please try again. --------------------编程问答-------------------- 写个方法放到 onCreate()外面 。--------------------编程问答-------------------- NullpointException,此时gridView中,并没有从adapter中拿到数据。所以gridview.getAtChild(0)取得的是空值。
建议解决方案使用BaseAdapter,override其中的
public boolean isEnabled(int position){}
方法来实现这一功能。
补充:移动开发 , Android