2014-02-24 49 views
2

我正在做动画,一些翻译动画使用,但这不是我想要的,我给了一个应用程序的参考前屏幕与动画...有三个气泡。最初他们将所有在一起后onTouch(),它只是打开了翻译成其x,y坐标通过位图像Goibibo翻译动画

这是我使用翻译的类,但我知道很多工作都要做

我绘制图讲座

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(); 

还附加im年龄.. enter image description here

回答