0
好吧,我有一個自定義AdapterView。每當我檢測到長時間點擊時,我都會調用一種方法來更改自定義的可編輯狀態。自定義適配器視圖沒有正確更新
public void setEditing(boolean editing) {
this.editing = editing;
//Set editing to children
for (int i=0; i < getChildCount(); i++){
((PresentationPickerGalleryCellView)getChildAt(i)).setEditing(editing);
if (editing == true)
getChildAt(i).setVisibility(View.INVISIBLE);
//((PresentationPickerGalleryCellView)getChildAt(i)).deleteImageButton.setVisibility(View.VISIBLE);
}
}
就我而言,它在主線程中執行。 現在,如果我叫:
getChildAt(i).setVisibility(View.INVISIBLE);
它編輯時隱藏整個視圖正確 ==真。但如果我打電話:
((PresentationPickerGalleryCellView)getChildAt(i)).deleteImageButton.setVisibility(View.VISIBLE);
deleteImageButton是單元格內的按鈕。 它不會在所有處顯示deleteImageButton。我嘗試invalidate,postInvalidate,佈局,requestLayout,refreshDrawableState,但沒有...
任何想法?
如果您不讓全部細胞可見?如果單元格不可見,那麼僅使單元格內的按鈕可見將無濟於事。 – Gogu 2012-07-24 09:04:23
當然,整個細胞是可見的。我只是測試隱藏整個單元格或在單元格內顯示按鈕的區別 – Lupi 2012-07-24 09:11:48