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


Java PhotoView.setImageDrawable方法代码示例

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


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

示例1: onCreate

import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ZoomableImageActivityIntentBuilder.inject(getIntent(), this);
    PhotoView view = new PhotoView(this);

    @DrawableRes int drawableRes;
    @StringRes int titleRes;
    if (type.equals(TYPE_ROOMS)) {
        drawableRes = R.drawable.venue_rooms;
        titleRes = R.string.venue_see_rooms;
    } else {
        drawableRes = R.drawable.venue_exhibitors;
        titleRes = R.string.venue_see_exhibitors;
    }

    view.setImageDrawable(ContextCompat.getDrawable(this, drawableRes));
    getSupportActionBar().setTitle(titleRes);
    setContentView(view);
}
 
开发者ID:Nilhcem,项目名称:devoxxfr-2016,代码行数:21,代码来源:ZoomableImageActivity.java

示例2: onCreate

import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ZoomableImageActivityIntentBuilder.inject(getIntent(), this);
    PhotoView view = new PhotoView(this);

    view.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.venue_rooms));
    view.setBackgroundColor(ContextCompat.getColor(this, android.R.color.white));
    getSupportActionBar().setTitle(R.string.venue_see_rooms);
    setContentView(view);
}
 
开发者ID:Nilhcem,项目名称:droidconde-2016,代码行数:12,代码来源:ZoomableImageActivity.java

示例3: onCreate

import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ZoomableImageActivityIntentBuilder.inject(getIntent(), this);
    PhotoView view = new PhotoView(this);

    // No drawable-nodpi venue_rooms file
    view.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.venue_rooms));
    view.setBackgroundColor(ContextCompat.getColor(this, android.R.color.white));
    getSupportActionBar().setTitle(R.string.venue_see_rooms);
    setContentView(view);
}
 
开发者ID:Nilhcem,项目名称:devfestnantes-2016,代码行数:13,代码来源:ZoomableImageActivity.java

示例4: onCreateView

import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_map, container, false);

    PhotoView photoView = (PhotoView)v.findViewById(R.id.indoormap);
    photoView.setMaximumScale(16);
    photoView.setImageDrawable(getResources().getDrawable(R.drawable.ic_map));
    return v;
}
 
开发者ID:SNiels,项目名称:Multi-Mania-app,代码行数:10,代码来源:MapFragment.java

示例5: init

import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
public void init(){
    if (animator != null) {
        animator.cancel();
    }
    container = (ContentFrameLayout) activity.findViewById(android.R.id.content);
    copyImageView = new PhotoView(activity);
    int matchParent = FrameLayout.LayoutParams.MATCH_PARENT;
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(matchParent, matchParent);
    copyImageView.setLayoutParams(params);
    r = new RelativeLayout(activity);
    r.setLayoutParams(params);
    r.setBackgroundColor(Color.BLACK);
    if (originalView instanceof ImageView) {
        copyImageView.setImageDrawable(((ImageView) originalView).getDrawable());
    } else {
        Bitmap bm = view2Bitmap(originalView);
        if (bm != null) {
            copyImageView.setImageBitmap(bm);
        }
    }
    copyImageView.setVisibility(View.GONE);
    r.setVisibility(View.GONE);
    container.addView(r);
    container.addView(copyImageView);
    startRect = new Rect();
    endRect = new Rect();
    Point offsetPoint = new Point();
    originalView.getGlobalVisibleRect(startRect);
    /**
     * r 是 绝对(global)坐标参数,包含状态栏、ActionBar、底部虚拟键
     * globalOffset 用于将global坐标转换成local坐标,这里的local坐标,是相对于内容区的坐标,也就是除了状态栏和action bar和虚拟按键的区域。
     * */
    container.getGlobalVisibleRect(endRect, offsetPoint);
    startRect.offset(-offsetPoint.x, -offsetPoint.y);
    endRect.offset(-offsetPoint.x, -offsetPoint.y);
    float scaleSize;
    float startScaleFinal;
    Log.d("garyhu","width == "+endRect.width());
    Log.d("garyhu","height == "+endRect.height());
    if ((float) endRect.width() / (float) endRect.height() > (float) startRect.width() / (float) startRect.height()) {
        startScale = (float) startRect.height() / (float) endRect.height();
        scaleSize = startScale * (float) endRect.width();
        startScaleFinal = (scaleSize - (float) startRect.width()) / 2.0F;
        startRect.left = (int) ((float) startRect.left - startScaleFinal);
        startRect.right = (int) ((float) startRect.right + startScaleFinal);
    } else {
        startScale = (float) startRect.width() / (float) endRect.width();
        scaleSize = startScale * (float) endRect.height();
        startScaleFinal = (scaleSize - (float) startRect.height()) / 2.0F;
        startRect.top = (int) ((float) startRect.top - startScaleFinal);
        startRect.bottom = (int) ((float) startRect.bottom + startScaleFinal);
    }
}
 
开发者ID:garyhu1,项目名称:collapselrecycler,代码行数:54,代码来源:BossZoomHelper.java


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