List of usage examples for android.widget ScrollView startAnimation
public void startAnimation(Animation animation)
From source file:com.example.fragment.ScreenSlidePageFragment.java
public void startAnimation() { // SELECT LAYER ScrollView relate = (ScrollView) mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate;// www .ja va 2 s . c o m float toX = -8.0f / 100.0f;//0.0f; float fromX = 0.0f;//-8.0f / 100.0f; float toY = 0.0f; float fromY = 29.0f / 100.0f; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(2000); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); }
From source file:com.openatk.planting.MainActivity.java
private void SliderShrink() { Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size);/*w w w . j av a2s . c o m*/ int oneThirdHeight = (size.y / 3); if (fragmentEditField != null) { ScrollView sv = (ScrollView) fragmentEditField.getView().findViewById(R.id.slider_scrollView); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) sv.getLayoutParams(); if (sliderPosition == 1) { //Middle -> Small DropDownAnim an = new DropDownAnim(sv, params.height, 0); an.setDuration(300); sv.startAnimation(an); sliderPosition = 0; } else if (sliderPosition == 2) { //Fullscreen -> Middle if has notes //Fullscreen -> Small if no notes if (false) { DropDownAnim an = new DropDownAnim(sv, params.height, oneThirdHeight); an.setDuration(300); sv.startAnimation(an); sliderPosition = 1; } else { DropDownAnim an = new DropDownAnim(sv, params.height, 0); an.setDuration(300); sv.startAnimation(an); sliderPosition = 0; } } sv.setLayoutParams(params); } }
From source file:com.openatk.planting.MainActivity.java
private void SliderGrow() { Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size);//from w ww .ja v a2 s . c o m int oneThirdHeight = size.y / 3; int actionBarHeight = 10; TypedValue tv = new TypedValue(); if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); } if (fragmentEditField != null) { RelativeLayout relAdd = (RelativeLayout) fragmentEditField.getView().findViewById(R.id.slider_layMenu); RelativeLayout relBottomBar = (RelativeLayout) fragmentEditField.getView() .findViewById(R.id.edit_field_layInfo3); Log.d("layMenu:", Integer.toString(relAdd.getHeight())); ScrollView sv = (ScrollView) fragmentEditField.getView().findViewById(R.id.slider_scrollView); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) sv.getLayoutParams(); if (sliderPosition == 0) { //Small -> Middle DropDownAnim an = new DropDownAnim(sv, params.height, oneThirdHeight); an.setDuration(300); sv.startAnimation(an); sliderPosition = 1; } else if (sliderPosition == 1) { //Middle -> Fullscreen DropDownAnim an = new DropDownAnim(sv, params.height, (fragMap.getView().getHeight() - relAdd.getHeight() - relBottomBar.getHeight())); Log.d("fullslider", "Full slider" + Integer.toString(relBottomBar.getHeight())); an.setDuration(300); sv.startAnimation(an); sliderPosition = 2; } sv.setLayoutParams(params); } }