I need to set a negative top margin to view, but it work on Huawei G300 with Kitkat, but not work on Samsung Galaxy SII with JB.
When I set top margin for example to -1dp on SII is whole view out of display (same as i set negative margin with height of view), but view should be by 1dp upper.
Is there any way to use nagative margins correctly?
Thanks for advance
if (Build.VERSION.SDK_INT >= 11 && y < getResources().getDimension(R.dimen.trip_map_height) / 2) {
photoSwitcher.setTranslationY(y);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) photoSwitcher.getLayoutParams();
if (layoutParams != null) {
layoutParams.topMargin = y * -1;
Log.d("Scroll", "Top margin: " + layoutParams.topMargin);
photoSwitcher.setLayoutParams(layoutParams);
photoSwitcher.requestLayout();
}
else {
Log.e("Scroll", "layout params null");
}
}