android 布局的动画
16lz
2021-01-23
android 的布局 动画,就是 布局的时候的动画,不会控件自身的动画。
好吧,直接上代码:
@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);LayoutInflater la = LayoutInflater.from(this);LinearLayout view = (LinearLayout) la.inflate(R.layout.activity_main,null);ScaleAnimation sc = new ScaleAnimation(0, 1, 0, 1);sc.setDuration(4300);LayoutAnimationController lac = new LayoutAnimationController(sc, 0.5f);// 上一个子控件动了一半的时候,后面开始动lac.setOrder(LayoutAnimationController.ORDER_REVERSE);// 从小向上的动画,其他资金试view.setLayoutAnimation(lac);setContentView(view);}
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /></LinearLayout>
直接运行上面的代码就可以了,吊炸天的动画,可以做出各种吊的东东
更多相关文章
- Android开发之如何手写代码进行页面布局
- android 自定义dialog,窗口动画,
- Android 自定义控件 ViewPager头部指示器控件 ViewPagerBelowInd
- android的 重要控件使用篇
- Android 控件TextView的属性
- Android组合控件自定义标题栏
- android 动态改变控件大小的方法
- androin各类动画效果实现
- android 日历控件