I am trying to do SwipeViews with some animations in each fragment. For example I would like to change alpha of button from 0 to 1.
I wrote animation
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<alpha
android:duration="2000"
android:fromAlpha="0.0"
android:interpolator="@android:anim/linear_interpolator"
android:toAlpha="1.0"/>
</set>
And I have working PagerAdapter with fragmets like this
public class FragmentOne extends Fragment {
private Button bw;
private Animation anim;
private Context CON;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
CON=container.getContext();
View vw = inflater.inflate(R.layout.fragemnt1,container,false);
bw=(Button)vw.findViewById(R.id.button);
anim= AnimationUtils.loadAnimation(CON,R.anim.animacia);
bw.startAnimation(anim);
retu inflater.inflate(R.layout.fragemnt1,container,false);
}
}
with layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F20C36" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="60dp"
android:visibility="invisible"/>
</RelativeLayout>
but those animations does not work. Nothing happens. Could somebody help me?
