首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android -翻译与规模布局的结合

Android -翻译与规模布局的结合
EN

Stack Overflow用户
提问于 2013-12-03 09:12:41
回答 1查看 267关注 0票数 0

你好,我想有动画从左到右,它应该散开部分从左到右,我有这样的布局:http://postimg.org/image/vzjx7w5l3/。当用户单击“黑色区域”时,应该像http://postimg.org/image/anp3efuyr/那样拉伸图像。

我试过跟随xmls。

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?> 
<translate xmlns:android="http://schemas.android.com/apk/res/android"       
  android:interpolator="@android:anim/linear_interpolator"       
  android:fromXDelta="1000"
  android:toXDelta="0"
  android:fromYDelta="0"
  android:toYDelta="0" 
  android:duration="2000"
  android:fillAfter="true" />

以上仅从右向左移动视图。

代码语言:javascript
复制
   <?xml version="1.0" encoding="utf-8"?>
<set
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:interpolator="@android:anim/linear_interpolator"
   android:fillAfter="true">
<translate
     android:fromXDelta="0%p"
     android:toXDelta="75%p"
     android:duration="800" />

以上仅由右向左移动,但多奈拉伸了廊柱。

我用过组合词:

代码语言:javascript
复制
   <?xml version="1.0" encoding="utf-8"?>
  <set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:fillAfter="true">

  <translate
      android:fromXDelta="0%p"
      android:toXDelta="75%p"
      android:duration="800" />
 <scale
     android:duration="500"
     android:fromXScale="1.0"
     android:fromYScale="1.0"
     android:interpolator="@android:anim/linear_interpolator"
     android:toXScale="1.0"
     android:toYScale="0.0" />
</set>

以上代码将整个视图移至东北。

我对动画很陌生。任何帮助都是徒劳无功。

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-12-03 09:36:28

尝试使用fromXScale和toXScale缩放视图。

代码语言:javascript
复制
<scale
       android:interpolator="@android:anim/accelerate_decelerate_interpolator"
        android:fromXScale="1.0"
        android:toXScale="2.0"
        android:fromYScale="1.0"
        android:toYScale="1.0"
        android:pivotX="0%"
        android:pivotY="0%"
        android:fillAfter="true"
        android:duration="1000" />
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20346987

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档