当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.setTranslationX方法代码示例

本文整理汇总了Java中android.widget.ImageView.setTranslationX方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setTranslationX方法的具体用法?Java ImageView.setTranslationX怎么用?Java ImageView.setTranslationX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.setTranslationX方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_explore);
    iv = (ImageView) findViewById(R.id.search);
    text = (EditText) findViewById(R.id.text);
    searchToBar = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_search_to_bar);
    barToSearch = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_bar_to_search);
    interp = AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in);
    duration = getResources().getInteger(R.integer.duration_bar);
    // iv is sized to hold the search+bar so when only showing the search icon, translate the
    // whole view left by half the difference to keep it centered
    offset = -71f * (int) getResources().getDisplayMetrics().scaledDensity;
    iv.setTranslationX(offset);
    iv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            animate();
        }
    });
}
 
开发者ID:braulio94,项目名称:Quadro,代码行数:22,代码来源:ExploreActivity.java

示例2: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // My nifty animation!
    // Declare the image view to use.
    ImageView aklu = (ImageView)findViewById(R.id.aklu);
    // Set it to be visable.
    aklu.setVisibility(View.VISIBLE);
    // Initially set that image off screen.
    aklu.setTranslationX(-1000f);
    // Bring image on screen and then off the screen again!
    aklu.animate().translationXBy(2000f).setDuration(3000);
    // And just to be sure, let's make it invisable again.
    aklu.setVisibility(View.INVISIBLE);

}
 
开发者ID:alaskalinuxuser,项目名称:apps_small,代码行数:19,代码来源:MainActivity.java

示例3: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Note that this image view is set off screen from the app start.
    // Define the image view to use.
    ImageView firstPic = (ImageView) findViewById(R.id.imageView2);
    // Set that view off screen.
    firstPic.setTranslationX(1000f);
}
 
开发者ID:alaskalinuxuser,项目名称:apps_small,代码行数:12,代码来源:MainActivity.java

示例4: transformPage

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void transformPage(ImageView ivBg, float position, int direction) {
    ivBg.setScaleX(mScale);
    ivBg.setScaleY(mScale);
    float totalMoveWidth = ivBg.getWidth() * ((mScale - 1) / 2);
    int lastPosition = Math.round(position);
    float mFraction;
    if (lastPosition % 2 == 0) {
        mFraction = -1 * (float) Math.sin(Math.PI * position);
    } else {
        mFraction = (float) Math.sin(Math.PI * position);
    }
    ivBg.setTranslationX(totalMoveWidth * mFraction);
}
 
开发者ID:codeestX,项目名称:ECardFlow,代码行数:15,代码来源:MoveAnimMode.java


注:本文中的android.widget.ImageView.setTranslationX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。