1 @Override
2 public View onCreateView(LayoutInflater inflater, ViewGroup container,
3 Bundle savedInstanceState) {
4 View rootView = inflater.inflate(R.layout.fragment_main, container, false);
5 rootView.findViewById(R.id.btnAnimMe).setOnClickListener(new View.OnClickListener() {
6 @Override
7 public void onClick(View arg0) {
8 arg0.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.aa));
9 }
10 });
11 return rootView;
12 }
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 fromAlpha:开始时透明度
4 toAlpha: 结束时透明度
5 duration:动画持续时间
6 -->
7 <alpha xmlns:android="http://schemas.android.com/apk/res/android"
8 android:fromAlpha="0"
9 android:toAlpha="1"
10 android:duration="1000" >
11 </alpha>