最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android控件Tween動(dòng)畫(補(bǔ)間動(dòng)畫)實(shí)現(xiàn)方法示例

 更新時(shí)間:2017年08月14日 09:34:34   作者:遲做總比不做強(qiáng)  
這篇文章主要介紹了Android控件Tween動(dòng)畫(補(bǔ)間動(dòng)畫)實(shí)現(xiàn)方法,結(jié)合具體實(shí)例形式分析了Android補(bǔ)間動(dòng)畫的原理、功能實(shí)現(xiàn)與布局相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了Android控件Tween動(dòng)畫(補(bǔ)間動(dòng)畫)實(shí)現(xiàn)方法。分享給大家供大家參考,具體如下:

Android動(dòng)畫中的Tween動(dòng)畫:是把控件對象不斷的進(jìn)行圖像變化來產(chǎn)生旋轉(zhuǎn)、平移、放縮和漸變等動(dòng)畫效果。

/**
 * 控件Tween動(dòng)畫
 * 
 * @description:
 * @author ldm
 * @date 2016-6-22 下午5:26:24
 */
public class TweenActivity extends Activity {
  private SeekBar seekBarX;// 拖動(dòng)條控件
  private SeekBar seekBarY;
  private SeekBar scaleSeekBarX;
  private SeekBar scaleSeekBarY;
  private SeekBar rotationSeekBarX;
  private SeekBar rotationSeekBarY;
  private SeekBar rotationSeekBarZ;
  private Button button;
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tween);
    initViews();
    initEvents();
  }
  /**
   * 
   * @description:初始化控件
   * @author ldm
   * @date 2016-6-22 下午5:26:26
   */
  private void initViews() {
    button = (Button) findViewById(R.id.button);
    seekBarX = (SeekBar) findViewById(R.id.translationX);
    seekBarX.setMax(400);
    seekBarY = (SeekBar) findViewById(R.id.translationY);
    seekBarY.setMax(800);
    scaleSeekBarX = (SeekBar) findViewById(R.id.scaleX);
    scaleSeekBarX.setMax(50);
    scaleSeekBarX.setProgress(10);
    scaleSeekBarY = (SeekBar) findViewById(R.id.scaleY);
    scaleSeekBarY.setMax(50);
    scaleSeekBarY.setProgress(10);
    rotationSeekBarX = (SeekBar) findViewById(R.id.rotationX);
    rotationSeekBarX.setMax(360);
    rotationSeekBarY = (SeekBar) findViewById(R.id.rotationY);
    rotationSeekBarY.setMax(360);
    rotationSeekBarZ = (SeekBar) findViewById(R.id.rotationZ);
    rotationSeekBarZ.setMax(360);
  }
  /**
   * 
   * @description:控件設(shè)置監(jiān)聽事件
   * @author ldm
   * @date 2016-6-22 下午5:26:26
   */
  private void initEvents() {
    // 按鈕X方向平移動(dòng)畫
    seekBarX.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
      public void onStopTrackingTouch(SeekBar seekBar) {
      }
      public void onStartTrackingTouch(SeekBar seekBar) {
      }
      public void onProgressChanged(SeekBar seekBar, int progress,
          boolean fromUser) {
        // X方向平移
        button.setTranslationX((float) progress);
      }
    });
    // 按鈕Y方向平移動(dòng)畫
    seekBarY.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
      public void onStopTrackingTouch(SeekBar seekBar) {
      }
      public void onStartTrackingTouch(SeekBar seekBar) {
      }
      public void onProgressChanged(SeekBar seekBar, int progress,
          boolean fromUser) {
        // Y方向平移
        button.setTranslationY((float) progress);
      }
    });
    // 按鈕X方向縮放動(dòng)畫
    scaleSeekBarX
        .setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
          public void onStopTrackingTouch(SeekBar seekBar) {
          }
          public void onStartTrackingTouch(SeekBar seekBar) {
          }
          public void onProgressChanged(SeekBar seekBar,
              int progress, boolean fromUser) {
            // X方向縮放
            button.setScaleX((float) progress / 10f);
          }
        });
    // 按鈕Y方向縮放動(dòng)畫
    scaleSeekBarY
        .setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
          public void onStopTrackingTouch(SeekBar seekBar) {
          }
          public void onStartTrackingTouch(SeekBar seekBar) {
          }
          public void onProgressChanged(SeekBar seekBar,
              int progress, boolean fromUser) {
            // Y方向縮放
            button.setScaleY((float) progress / 10f);
          }
        });
    // 按鈕X方向旋轉(zhuǎn)動(dòng)畫
    rotationSeekBarX
        .setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
          public void onStopTrackingTouch(SeekBar seekBar) {
          }
          public void onStartTrackingTouch(SeekBar seekBar) {
          }
          public void onProgressChanged(SeekBar seekBar,
              int progress, boolean fromUser) {
            // X方向旋轉(zhuǎn)
            button.setRotationX((float) progress);
          }
        });
    // 按鈕Y方向旋轉(zhuǎn)動(dòng)畫
    rotationSeekBarY
        .setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
          public void onStopTrackingTouch(SeekBar seekBar) {
          }
          public void onStartTrackingTouch(SeekBar seekBar) {
          }
          public void onProgressChanged(SeekBar seekBar,
              int progress, boolean fromUser) {
            // Y方向旋轉(zhuǎn)
            button.setRotationY((float) progress);
          }
        });
    // 按鈕Z方向旋轉(zhuǎn)動(dòng)畫
    rotationSeekBarZ
        .setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
          public void onStopTrackingTouch(SeekBar seekBar) {
          }
          public void onStartTrackingTouch(SeekBar seekBar) {
          }
          public void onProgressChanged(SeekBar seekBar,
              int progress, boolean fromUser) {
            // 設(shè)置旋轉(zhuǎn)
            button.setRotation((float) progress);
          }
        });
  }
}

布局文件R.layout.activity_tween

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/container"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  android:splitMotionEvents="true" >
  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dip"
    android:orientation="horizontal"
    android:splitMotionEvents="true" >
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingLeft="5dip"
      android:paddingRight="5dip"
      android:text="TX"
      android:textStyle="bold" />
    <SeekBar
      android:id="@+id/translationX"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:orientation="horizontal" />
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingLeft="15dip"
      android:paddingRight="5dip"
      android:text="TY"
      android:textStyle="bold" />
    <SeekBar
      android:id="@+id/translationY"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:orientation="horizontal" />
  </LinearLayout>
  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dip"
    android:orientation="horizontal"
    android:splitMotionEvents="true" >
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingLeft="5dip"
      android:paddingRight="5dip"
      android:text="SX"
      android:textStyle="bold" />
    <SeekBar
      android:id="@+id/scaleX"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:orientation="horizontal" />
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingLeft="15dip"
      android:paddingRight="5dip"
      android:text="SY"
      android:textStyle="bold" />
    <SeekBar
      android:id="@+id/scaleY"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:orientation="horizontal" />
  </LinearLayout>
  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dip"
    android:orientation="horizontal"
    android:splitMotionEvents="true" >
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingLeft="5dip"
      android:paddingRight="5dip"
      android:text="X"
      android:textStyle="bold" />
    <SeekBar
      android:id="@+id/rotationX"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:orientation="horizontal" />
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingLeft="15dip"
      android:paddingRight="5dip"
      android:text="Y"
      android:textStyle="bold" />
    <SeekBar
      android:id="@+id/rotationY"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:orientation="horizontal" />
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingLeft="15dip"
      android:paddingRight="5dip"
      android:text="Z"
      android:textStyle="bold" />
    <SeekBar
      android:id="@+id/rotationZ"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:orientation="horizontal" />
  </LinearLayout>
  <Button
    android:id="@+id/rotatingButton"
    android:layout_width="200dip"
    android:layout_height="150dip"
    android:layout_marginLeft="50dip"
    android:layout_marginTop="50dip"
    android:text="Rotating Button" />
</LinearLayout>

更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android開發(fā)動(dòng)畫技巧匯總》、《Android開發(fā)入門與進(jìn)階教程》、《Android視圖View技巧總結(jié)》、《Android編程之a(chǎn)ctivity操作技巧總結(jié)》、《Android文件操作技巧匯總》、《Android資源操作技巧匯總》及《Android控件用法總結(jié)

希望本文所述對大家Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • Android自定義dialog 自下往上彈出的實(shí)例代碼

    Android自定義dialog 自下往上彈出的實(shí)例代碼

    本文通過實(shí)例代碼給大家介紹了Android自定義dialog 自下往上彈出效果,代碼簡單易懂,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
    2018-08-08
  • Android中各種Time API詳細(xì)

    Android中各種Time API詳細(xì)

    這篇文章要分享的是Android中各種Time API, SystemClock.uptimeMillis()、System.nanoTime(),下面我們就來看看他們到底有什么區(qū)別吧
    2021-10-10
  • Android中Dialog對話框的使用小結(jié)

    Android中Dialog對話框的使用小結(jié)

    這篇文章主要給大家總結(jié)了一些關(guān)于Android中Dialog對話框的使用方法,這其中包括普通對話框、確定取消對話框、多按鈕對話框、列表對話框、帶Adapter的對話框、單選對話框以及多選對話框等,需要的朋友可以參考學(xué)習(xí),下面來一起看看詳細(xì)的介紹吧。
    2017-04-04
  • Android實(shí)現(xiàn)界面定時(shí)刷新功能

    Android實(shí)現(xiàn)界面定時(shí)刷新功能

    在移動(dòng)應(yīng)用中,界面定時(shí)刷新是非常常見的需求,本教程將以一個(gè)“實(shí)時(shí)時(shí)鐘”示例為主線,演示多種常用的定時(shí)刷新的實(shí)現(xiàn)方式,并對比它們的代碼簡潔度、性能消耗、生命周期管理與取消機(jī)制,幫助您在項(xiàng)目中快速選型并上手,需要的朋友可以參考下
    2025-04-04
  • Android適配器(Adapter)的概念與自定義

    Android適配器(Adapter)的概念與自定義

    這篇文章主要給大家介紹了關(guān)于Android適配器(Adapter)的相關(guān)資料,適配器是一個(gè)非常重要的知識點(diǎn),Adapter是用來幫助填出數(shù)據(jù)的中間橋梁,本文介紹的非常詳細(xì),需要的朋友可以參考下
    2021-07-07
  • Android將Glide動(dòng)態(tài)加載不同大小的圖片切圓角與圓形的方法

    Android將Glide動(dòng)態(tài)加載不同大小的圖片切圓角與圓形的方法

    這篇文章主要給大家介紹了關(guān)于Android如何將Glide動(dòng)態(tài)加載不同大小的圖片切圓角與圓形的方法,文中通過示例代碼介紹的非常吸納關(guān)系,對各位Android開發(fā)者們具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-11-11
  • 分析Android 11.0Settings源碼之主界面加載

    分析Android 11.0Settings源碼之主界面加載

    這篇文章主要介紹了分析Android 11.0Settings源碼之主界面加載,對Android源碼感興趣的同學(xué),可以著重看一下
    2021-04-04
  • Android Studio中debug功能詳解

    Android Studio中debug功能詳解

    這篇文章主要為大家詳細(xì)介紹了Android Studio中debug功能的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-05-05
  • Android自定義控件繪制基本圖形基礎(chǔ)入門

    Android自定義控件繪制基本圖形基礎(chǔ)入門

    這篇文章主要為大家詳細(xì)介紹了Android自定義控件繪制基本圖形基礎(chǔ)入門資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-01-01
  • Android ViewFlipper的詳解及實(shí)例

    Android ViewFlipper的詳解及實(shí)例

    這篇文章主要介紹了Android ViewFlipper的詳解及實(shí)例的相關(guān)資料,通過本文希望能幫助大家理解這部分內(nèi)容,需要的朋友可以參考下
    2017-08-08

最新評論

舟曲县| 泸溪县| 蓬溪县| 济源市| 孟连| 北宁市| 郑州市| 塔河县| 颍上县| 通州市| 昌邑市| 额济纳旗| 枞阳县| 尉氏县| 本溪市| 富蕴县| 舟曲县| 梅州市| 石城县| 信丰县| 海阳市| 尚义县| 儋州市| 秦皇岛市| 个旧市| 南岸区| 山东| 富蕴县| 乌拉特后旗| 鄂尔多斯市| 绥化市| 微博| 芜湖市| 迭部县| 蒙阴县| 那曲县| 泗洪县| 盈江县| 北安市| 依安县| 荣成市|