Example usage for android.view.animation TranslateAnimation start

List of usage examples for android.view.animation TranslateAnimation start

Introduction

In this page you can find the example usage for android.view.animation TranslateAnimation start.

Prototype

public void start() 

Source Link

Document

Convenience method to start the animation the first time #getTransformation(long,Transformation) is invoked.

Usage

From source file:Main.java

public static void startTranslationAnimation(View view) {
    TranslateAnimation translateAnimation = new TranslateAnimation(-50f, 50f, 0, 0);
    translateAnimation.setDuration(1000);
    translateAnimation.setRepeatCount(Animation.INFINITE);
    translateAnimation.setRepeatMode(Animation.REVERSE);
    view.setAnimation(translateAnimation);
    translateAnimation.start();
}

From source file:xj.property.activity.HXBaseActivity.ChatActivity.java

private void showPopWindow2() {

    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View mMenuView = inflater.inflate(R.layout.unservice_time, null);
    ((TextView) mMenuView.findViewById(R.id.tv_unservicetime)).setText("?"
            + MainActivity.startTime + "-" + MainActivity.endTime
            + "????");
    ((TextView) mMenuView.findViewById(R.id.tv_unservicetime))
            .setTextSize(getResources().getDimension(R.dimen.tv_unservicetime));
    final PopupWindow popupWindow = new PopupWindow();
    // ?/*from w w  w  . ja  va2  s  . com*/
    // SelectPicPopupWindowView
    popupWindow.setContentView(mMenuView);
    // SelectPicPopupWindow
    popupWindow.setWidth(LinearLayout.LayoutParams.MATCH_PARENT);
    // SelectPicPopupWindow
    popupWindow.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
    // SelectPicPopupWindow?
    //        this.setFocusable(true);
    // SelectPicPopupWindow
    //  popupWindow.setAnimationStyle(R.style.AnimTop);
    TranslateAnimation translateAnimation = new TranslateAnimation(0, 0.0f, 0, 200f);
    translateAnimation.setDuration(2000);
    translateAnimation.setFillAfter(true);
    ((TextView) mMenuView.findViewById(R.id.tv_unservicetime)).setAnimation(translateAnimation);
    translateAnimation.start();
    // ColorDrawable??
    ColorDrawable dw = new ColorDrawable(0xb0000000);
    // SelectPicPopupWindow
    // mMenuViewOnTouchListener??????
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            // ,Animation.RELATIVE_TO_SELF,10f,Animation.RELATIVE_TO_SELF,10f
            popupWindow.showAsDropDown(findViewById(R.id.top_bar));
            //popupWindow.showAtLocation(findViewById(R.id.list),Gravity.NO_GRAVITY,0,0);
        }
    }, 200);

}