public SampleView(Context context) { super(context); setFocusable(true); setFocusableInTouchMode(true); Drawable dr = context.getResources().getDrawable(R.drawable.beach); dr.setBounds(0, 0, dr.getIntrinsicWidth(), dr.getIntrinsicHeight()); Animation an = new TranslateAnimation(0, 100, 0, 200); an.setDuration(2000); an.setRepeatCount(-1); an.initialize(10, 10, 10, 10); mDrawable = new AnimateDrawable(dr, an); an.startNow(); }
public SampleView(Context context) { super(context); setFocusable(true); setFocusableInTouchMode(true); Drawable dr = context.getResources().getDrawable(R.drawable.beach); dr.setBounds(0, 0, dr.getIntrinsicWidth(), dr.getIntrinsicHeight()); Animation an = new TranslateAnimation(0, 100, 0, 200); an.setDuration(2000); an.setRepeatCount(-1); an.initialize(10, 10, 10, 10); mDrawable = new AnimateDrawable(dr, an); an.startNow(); }