【Android】37

62 阅读1分钟

3.修改activity_main.xml。

<LinearLayout xmlns:android="schemas.android.com/apk/res/and…"

xmlns:tools="schemas.android.com/tools"

android:id="@+id/linearLayout"

android:orientation="vertical"

android:layout_width="match_parent"

android:layout_height="match_parent"

tools:context=".MainActivity">

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="布局动画"/>

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="布局动画"/>

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="布局动画"/>

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="布局动画"/>

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="布局动画"/>

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="布局动画"/>

4.效果图。

title

5.以上为代码方式,以下为XML方式。修改MainActivity。

public class MainActivity extends AppCompatActivity{

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

}

}

6.新建aa.xml。

<scale xmlns:android="schemas.android.com/apk/res/and…"

android:fromXScale="0"

android:toXScale="1"

android:fromYScale="0"

android:toYScale="1"

android:duration="3000">

7.新建aa_layout.xml。

<layoutAnimation xmlns:android="schemas.android.com/apk/res/and…"

android:animation="@anim/aa"

android:delay="0.3"

android:animationOrder="reverse">

8.修改activity_main.xml。

<LinearLayout xmlns:android="schemas.android.com/apk/res/and…"

xmlns:tools="schemas.android.com/tools"

android:orientation="vertical"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layoutAnimation="@anim/aa_layout"

tools:context=".MainActivity">

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="布局动画XML"/>

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="布局动画XML"/>

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="布局动画XML"/>

<Button

android:layout_width="match_parent"

最后

文末放一个小福利给大家,点击我的GitHub即可领取

群内有许多技术大牛,有任何问题,欢迎广大网友一起来交流,群内还不定期免费分享高阶Android学习视频资料和面试资料包~

偷偷说一句:群里高手如云,欢迎大家加群和大佬们一起交流讨论啊!