public override void bindItemView([email protected] item, [email protected] itemView) { itemView.initialize(item, 0); [email protected] menuView = ([email protected] )mMenuView; [email protected] actionItemView = ([email protected] )itemView; actionItemView.setItemInvoker(menuView); }
/// <summary>Measure a child view to fit within cell-based formatting.</summary> /// <remarks> /// Measure a child view to fit within cell-based formatting. The child's width /// will be measured to a whole multiple of cellSize. /// <p>Sets the expandable and cellsUsed fields of LayoutParams. /// </remarks> /// <param name="child">Child to measure</param> /// <param name="cellSize">Size of one cell</param> /// <param name="cellsRemaining">Number of cells remaining that this view can expand to fill /// </param> /// <param name="parentHeightMeasureSpec">MeasureSpec used by the parent view</param> /// <param name="parentHeightPadding">Padding present in the parent view</param> /// <returns>Number of cells this child was measured to occupy</returns> internal static int measureChildForCells(android.view.View child, int cellSize, int cellsRemaining, int parentHeightMeasureSpec, int parentHeightPadding) { [email protected] lp = ([email protected] .LayoutParams)child.getLayoutParams(); int childHeightSize = android.view.View.MeasureSpec.getSize(parentHeightMeasureSpec ) - parentHeightPadding; int childHeightMode = android.view.View.MeasureSpec.getMode(parentHeightMeasureSpec ); int childHeightSpec = android.view.View.MeasureSpec.makeMeasureSpec(childHeightSize , childHeightMode); int cellsUsed = 0; if (cellsRemaining > 0) { int childWidthSpec = android.view.View.MeasureSpec.makeMeasureSpec(cellSize * cellsRemaining , android.view.View.MeasureSpec.AT_MOST); child.measure(childWidthSpec, childHeightSpec); int measuredWidth = child.getMeasuredWidth(); cellsUsed = measuredWidth / cellSize; if (measuredWidth % cellSize != 0) { cellsUsed++; } } [email protected] itemView = child is [email protected] ? ([email protected])child : null; bool expandable = !lp.isOverflowButton && itemView != null && itemView.hasText(); lp.expandable = expandable; lp.cellsUsed = cellsUsed; int targetWidth = cellsUsed * cellSize; child.measure(android.view.View.MeasureSpec.makeMeasureSpec(targetWidth, android.view.View .MeasureSpec.EXACTLY), childHeightSpec); return(cellsUsed); }