public int measureCellWidth( Context context, View cell )
{

   
// We need a fake parent
   
FrameLayout buffer = new FrameLayout( context );
    android
.widget.AbsListView.LayoutParams layoutParams = new  android.widget.AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    buffer
.addView( cell, layoutParams);

    cell
.forceLayout();
    cell
.measure(1000, 1000);

   
int width = cell.getMeasuredWidth();

    buffer
.removeAllViews();

   
return width;
}

+ Recent posts