View从底部向上滑动出现
2016-08-12 00:00
232 查看
从屏幕底部向上滑出一个view的方式,主要是使用TranslateAnimation,这个类,可以绑定一个控件,在y轴方向,滑出一段高度,如下代码:
package com.txlong;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.TextView;
public class AndroidAnimationActivity extends Activity {
}
package com.txlong;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.TextView;
public class AndroidAnimationActivity extends Activity {
private Animation myAnimation_Translate; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final TextView tv = (TextView) findViewById(R.id.tv); Button btn = (Button) findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { tv.setVisibility(View.VISIBLE); myAnimation_Translate = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, -1, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0); myAnimation_Translate.setDuration(1000); myAnimation_Translate.setInterpolator(AnimationUtils .loadInterpolator(AndroidAnimationActivity.this, android.R.anim.accelerate_decelerate_interpolator)); tv.startAnimation(myAnimation_Translate); } }); }
}
相关文章推荐
- Activity启动从底部向上滑动出现,关闭的时候从顶部向下滑动消失的动画实现---Android提高篇
- android窗体动画:activity启动从底部向上滑动出现,关闭的时候从顶部向下滑动消失的动画实现【转】
- android窗体动画:activity启动从底部向上滑动出现,关闭的时候从顶部向下滑动消失,并解决activity跳转的时候出现短暂的黑屏
- iOS开发>学无止境 - UITablView上下滑动控制底部按钮的出现和消失
- 如何去掉滑动控件(比如ScrollView、ListView、ViewPager等)滑动到最顶部或最底部时出现的阴影效果。
- android窗体动画:activity启动从底部向上滑动出现,关闭的时候从顶部向下滑动消失的动画实现
- android窗体动画:activity启动从底部向上滑动出现,关闭的时候从顶部向下滑动消失的动画实现
- ListView和GridView,ViewPager滑动到顶部和底部时出现的阴影消除方法
- iOS tableview滑动到底部自动加载,向上拽加载
- Activity跳转出现黑屏,底部向上滑动动画
- android窗体动画:activity启动从底部向上滑动出现,关闭的时候从顶部向下滑动消失的动画实现
- android窗体动画:activity启动从底部向上滑动出现,关闭的时候从顶部向下滑动消失,并解决activity跳转的时候出现短暂的黑屏
- android ScrollView嵌套ListView自动滑动到底部,嵌套ViewPager出现的滑动冲突以及监听滑动停止
- UITableView 左右滑动时,出现删除按钮的动画。
- webview乱码 自动适应屏幕 当滑动时出现放大镜控件 webview小窍门
- Android学习自定义View(四)——继承控件(滑动时ListView的Item出现删除按钮)
- UITableView 左右滑动时,出现删除按钮的动画(可自定义)。
- 禁止ScrollView的childview自动滑动到底部
- 修复在“Android 在ScrollView中嵌入ViewPage后ViewPage不能很好的工作的问题解决”这篇博客中MyScrollView出现滑动一会就不会上下滑动的问题
- Android 利用ViewPager实现底部圆点导航左右滑动效果以及Fragment页面切换