像Goibibo应用程序一样通过Bitmap翻译动画

时间:2014-02-24 06:05:44

标签: android animation bitmap android-canvas surfaceview

我正在做动画,有些翻译动画使用但这不是我想要的我已经给出了应用程序前面的屏幕动画的参考...有三个气泡。最初它们将在一起并且在onTouch()之后它只是打开翻译到x,y坐标

这是我用来翻译的课程,但我知道还有很多工作需要完成

我的Draw视图类 -

public class DrawView extends View {
Paint paint = new Paint();
private int height;
Bitmap circlegreen ,circlered,circleyellow;

    public DrawView(Context context, int height) {
        super(context); 
        this.height = height;

        circlegreen=BitmapFactory.decodeResource(getResources(), R.drawable.circlegreen);
        circlered=BitmapFactory.decodeResource(getResources(), R.drawable.circlered);
        circleyellow=BitmapFactory.decodeResource(getResources(), R.drawable.circleyellow);
        this.height= this.height+circleyellow.getHeight();
    }

    @Override
    public void onDraw(Canvas canvas) {
    paint.setColor(Color.RED);
          canvas.drawBitmap(circlegreen, 30, height, paint);
          canvas.drawBitmap(circlered, 30, height, paint);
          canvas.drawBitmap(circleyellow, 30, height, paint);
       // canvas.drawRect(30, height, 60, 300, paint );

    }

And in the fragment i am adding this DrawView to container..


        @SuppressLint("NewApi")
        @Override
        public View onCreateView(LayoutInflater inflater, final ViewGroup container,
                Bundle savedInstanceState) {
            //View view = inflater.inflate(R.layout.fragment_home, container, false);
            //dineInBtn=(Button) view.findViewById(R.id.dinein);
            Display display = getActivity().getWindowManager().getDefaultDisplay();
            Point size = new Point();
            display.getSize(size);
            int width = size.x;
             height = size.y;

             Log.v("width=", width+"");
             Log.v("height=", height+"");

            final CountDownTimer timer = new CountDownTimer(2000, 50) {

                @Override
                public void onTick(long millisUntilFinished) {

                    height = height - 10;
                    drawView = new DrawView(getActivity(), height);
                    drawView.setBackgroundColor(Color.WHITE);
                    container.addView(drawView);
                }

                @Override
                public void onFinish() {

                }
            };
            Runnable run=new Runnable() {

                @Override
                public void run() {
                    timer.start();

                }
            };
            new Thread(run).start();

同时附加图片.. enter image description here

2 个答案:

答案 0 :(得分:1)

可以使用arc菜单库: here is library

答案 1 :(得分:-1)

其ARC菜单库您可以在下面找到示例 https://github.com/daCapricorn/ArcMenu