//=================================
@Override
public void onAttachedToWindow(){
super.onAttachedToWindow();
if(android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.LOLLIPOP)
setElevation(20f);
setOnTouchListener(this);
animate().alpha(0).setDuration(0).start();
startX = getX();
postDelayed(new Runnable(){public void run(){
WindowManager mgr = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics dm = new DisplayMetrics();
mgr.getDefaultDisplay().getMetrics(dm);
dwidth = dm.widthPixels;
View parent = (View)getParent();
ValueAnimator anim = ObjectAnimator.ofFloat(CategoriesSlideView.this, "translationX", 0, parent.getX()+parent.getWidth()-Offset);
anim.setDuration(0);
anim.start();
}}, 400);
}