【问题标题】:How to set two animations to layouts and trigger it when the orientation changes?如何为布局设置两个动画并在方向改变时触发它?
【发布时间】:2015-05-01 01:01:26
【问题描述】:

我希望我的布局动画并旋转 90 度(左/右),而不是为其横向模式创建新的 xml 布局。

【问题讨论】:

标签: android android-layout android-animation


【解决方案1】:

尝试将此代码添加到您的 onCreate() 方法中。我无法尝试,但这应该可以工作,因为它在更改方向时也会调用 oncreate 方法。

if(getResources().getConfiguration().orientation==Configuration.ORIENTATION_PORTRAIT){
        //insert your code here when it is portrait
    }
    else if(getResources().getConfiguration().orientation==Configuration.ORIENTATION_LANDSCAPE){
        //insert your code here when it is landscape
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多