當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。