This method is used to align item from left side in gallery.
WindowManager wm=(WindowManager) mcontext.getSystemService(Context.WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(metrics);
MarginLayoutParams mlp = (MarginLayoutParams) Gallery.getLayoutParams();
mlp.setMargins(-((metrics.widthPixels/2)+100),
mlp.topMargin,
mlp.rightMargin,
mlp.bottomMargin
);
WindowManager wm=(WindowManager) mcontext.getSystemService(Context.WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(metrics);
MarginLayoutParams mlp = (MarginLayoutParams) Gallery.getLayoutParams();
mlp.setMargins(-((metrics.widthPixels/2)+100),
mlp.topMargin,
mlp.rightMargin,
mlp.bottomMargin
);
The only that works! Thank you!!!
ReplyDelete