本文介绍了Android的滑入滑出的活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个Android应用程序中的活动九个不会加载一个布局文件。他们的观点是私有类,扩展了View类。活动构造视图对象在运行时,使用这些对象,而不是布局文件。我有问题的是,视图创建这些活动应滑入和切换到其它视图时滑出左,右。我已经使用前ViewFlipper,但我无法之一,在这里我需要自认为的鳍状肢带布局文件,而不是活动。是否有任何机会,我的问题能解决而不在切换到布局文件来解决?

I have an Android app in which nine of the activities do not load a layout file. Their views are private classes which extend the View class. The activity construct view objects at runtime and uses these objects instead of layout files. The problem that I have is that the views created these activities should slide in and slide out both left and right when switching to other views. I have used a ViewFlipper before but I am unable to one with my need here since view flippers take layout files rather than activities. Is there any chance my problem can be solved without resolving to switching to layout files?

推荐答案

试着放入系统

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <translate
        android:duration="@android:integer/config_longAnimTime"
        android:fromXDelta="0"
        android:fromYDelta="0"
        android:interpolator="@android:anim/linear_interpolator"
        android:toXDelta="-100%"
        android:toYDelta="0" />
</set>

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <translate
        android:duration="@android:integer/config_longAnimTime"
        android:fromXDelta="100%"
        android:fromYDelta="0"
        android:interpolator="@android:anim/linear_interpolator"
        android:toXDelta="0"
        android:toYDelta="0" />
</set>

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <translate
        android:duration="@android:integer/config_longAnimTime"
        android:fromXDelta="-100%"
        android:fromYDelta="0"
        android:interpolator="@android:anim/linear_interpolator"
        android:toXDelta="0"
        android:toYDelta="0" />
</set>

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <translate
        android:duration="@android:integer/config_longAnimTime"
        android:fromXDelta="0"
        android:fromYDelta="0"
        android:interpolator="@android:anim/linear_interpolator"
        android:toXDelta="100%"
        android:toYDelta="0" />
</set>

而在code时做StartActivity()

And in the code when doing StartActivity()

overridePendingTransition(R.animator.anim_left, R.animator.anim_right);

,然后做结束时()

and then when doing finish()

overridePendingTransition(R.animator.anim_left, R.animator.anim_right);

这篇关于Android的滑入滑出的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 19:48