當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.setRotation方法代碼示例

本文整理匯總了Java中android.widget.ImageView.setRotation方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.setRotation方法的具體用法?Java ImageView.setRotation怎麽用?Java ImageView.setRotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.setRotation方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: displayImageFromPath

import android.widget.ImageView; //導入方法依賴的package包/類
public static void displayImageFromPath(String fileName, ImageView imageView, boolean isCameraImage) {
    File imgFile = new File(fileName);

    if (imgFile.exists()) {
        Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
        imageView.setVisibility(View.VISIBLE);
        imageView.setImageBitmap(myBitmap);
        if (isCameraImage) {
            imageView.setRotation(90);
        } else {
            imageView.setRotation(0);
        }

    }

}
 
開發者ID:dazcode,項目名稱:smart-device-cloud,代碼行數:17,代碼來源:Utilities.java

示例2: setRotation

import android.widget.ImageView; //導入方法依賴的package包/類
public static void setRotation(ImageView view,float degree) {
    view.setRotation(degree);
    if (view.getDrawable() != null) {
        if (degree == 90 || degree == 270) {
            int viewWidth = view.getDrawable().getIntrinsicWidth();// mImageView.getWidth();
            int viewHeight = view.getDrawable().getIntrinsicHeight();//mImageView.getHeight();
            view.setScaleX(viewWidth / (float) viewHeight);
            view.setScaleY(viewHeight / (float) viewHeight);
        } else {
            view.setScaleX(1);
            view.setScaleY(1);
        }
    }
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:15,代碼來源:BitmapCommonUtils.java

示例3: updateScanData

import android.widget.ImageView; //導入方法依賴的package包/類
private void updateScanData(List<GlucoseData> trend) {
    if (trend.size() == 0) {
        Toast.makeText(this.getContext(), "No current data available!", Toast.LENGTH_LONG).show();
        return;
    }

    mDataPlotView.findViewById(R.id.scan_data).setVisibility(View.VISIBLE);

    GlucoseData currentGlucose = trend.get(trend.size() - 1);
    TextView tv_currentGlucose = (TextView) mDataPlotView.findViewById(R.id.tv_glucose_current_value);
    tv_currentGlucose.setText(
            String.format(getResources().getString(R.string.glucose_current_value),
            currentGlucose.glucoseString(),
            getDisplayUnit())
    );

    PredictionData predictedGlucose = new PredictionData(trend);

    TextView tv_predictedGlucose = (TextView) mDataPlotView.findViewById(R.id.tv_glucose_prediction);
    tv_predictedGlucose.setText(String.valueOf(predictedGlucose.glucoseData.glucoseString()));
    tv_predictedGlucose.setAlpha((float) min(1, 0.1 + predictedGlucose.confidence()));

    ImageView iv_unit = (ImageView) mDataPlotView.findViewById(R.id.iv_unit);
    if (GLUCOSE_UNIT_IS_MMOL) {
        iv_unit.setImageResource(R.drawable.ic_unit_mmoll);
    } else {
        iv_unit.setImageResource(R.drawable.ic_unit_mgdl);
    }
    iv_unit.setAlpha((float) min(1, 0.1 + predictedGlucose.confidence()));

    ImageView iv_predictionArrow = (ImageView) mDataPlotView.findViewById(R.id.iv_glucose_prediction);

    // rotate trend arrow according to glucose prediction slope
    float rotationDegrees = -90f * max(-1f, min(1f, (float) (predictedGlucose.glucoseSlopeRaw / TREND_UP_DOWN_LIMIT)));
    iv_predictionArrow.setRotation(rotationDegrees);

    // reduce trend arrow visibility according to prediction confidence
    iv_predictionArrow.setAlpha((float) min(1, 0.1 + predictedGlucose.confidence()));
}
 
開發者ID:DorianScholz,項目名稱:OpenLibre,代碼行數:40,代碼來源:DataPlotFragment.java

示例4: rotateImageView

import android.widget.ImageView; //導入方法依賴的package包/類
private void rotateImageView(ImageView imageView, float spend) {
  imageView.setPivotX(imageView.getWidth() / 2);
  imageView.setPivotY(imageView.getHeight() / 2);
  imageView.setRotation(spend / mHeaderViewPadding * 180);
}
 
開發者ID:Lingzh0ng,項目名稱:BrotherWeather,代碼行數:6,代碼來源:CustomRefreshLayout.java

示例5: handleRotateLeft

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Ação para rotacionar para esquerda
 */
public static void handleRotateLeft(ImageView mImageSelected) {
    mImageSelected.setRotation(mImageSelected.getRotation() - 5);
}
 
開發者ID:Eduardo8609,項目名稱:PhotoApp,代碼行數:7,代碼來源:ImageUtil.java

示例6: handleRotateRight

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Ação para rotacionar para direita
 */
public static void handleRotateRight(ImageView mImageSelected) {
    mImageSelected.setRotation(mImageSelected.getRotation() + 5);
}
 
開發者ID:Eduardo8609,項目名稱:PhotoApp,代碼行數:7,代碼來源:ImageUtil.java

示例7: inflateDialogView

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
    protected View inflateDialogView(FrameLayout dialogRootLayout, LayoutInflater inflater) {
        LinearLayout containLayout = new LinearLayout(mActivity);
        containLayout.setOrientation(LinearLayout.VERTICAL);

        if (canCanceledOnOutside()) {
            containLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    finishDialog();
                }
            });
        }

        ImageView triangleView = new ImageView(mActivity);
        triangleView.setImageResource(R.drawable.base_trigon);
        if (showTriangle) {
            triangleView.measure(View.MeasureSpec.makeMeasureSpec(1 << 30 - 1, View.MeasureSpec.AT_MOST),
                    View.MeasureSpec.makeMeasureSpec(1 << 30 - 1, View.MeasureSpec.AT_MOST));
        }

        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-1, -2);
        LinearLayout.LayoutParams triangleParams = new LinearLayout.LayoutParams(-2, -2);

//        final int[] drawingLocation = mTmpDrawingLocation;
//        anchorView.getLocationInWindow(drawingLocation);

        final Rect displayFrame = new Rect();
        anchorView.getWindowVisibleDisplayFrame(displayFrame);

        final int[] screenLocation = mTmpScreenLocation;
        anchorView.getLocationOnScreen(screenLocation);

        int anchorWidth = anchorView.getMeasuredWidth();
        int anchorHeight = anchorView.getMeasuredHeight();

        if (screenLocation[0] + anchorWidth / 2 < displayFrame.width() / 2) {
            //左半屏
            triangleParams.gravity = Gravity.START;
            triangleParams.leftMargin = screenLocation[0] + anchorWidth / 2 - triangleView.getMeasuredWidth() / 2;
        } else {
            //右半屏
            triangleParams.gravity = Gravity.END;
            triangleParams.rightMargin = displayFrame.right - screenLocation[0] - anchorWidth / 2 - triangleView.getMeasuredWidth() / 2;
        }

        if (screenLocation[1] + anchorHeight / 2 < displayFrame.height() / 2) {
            //在屏幕上半部
            params.topMargin = screenLocation[1] + anchorHeight + offsetY;
            if (showTriangle) {
                containLayout.addView(triangleView, triangleParams);
            }
            LayoutInflater.from(mActivity).inflate(layoutId, containLayout);
            gravity = Gravity.TOP;
        } else {
            //在屏幕下半部
            LayoutInflater.from(mActivity).inflate(layoutId, containLayout);
            if (showTriangle) {
                triangleView.setRotation(180);
                containLayout.addView(triangleView, triangleParams);
            }
            params.bottomMargin = displayFrame.bottom - screenLocation[1] + offsetY;
            params.gravity = Gravity.BOTTOM;
            gravity = Gravity.BOTTOM;
        }

        dialogRootLayout.addView(containLayout, params);
        resetDialogGravity();

        if (mOnInitWindow != null) {
            mOnInitWindow.onInitWindow(this, new RBaseViewHolder(containLayout));
        }
        return containLayout;
    }
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:75,代碼來源:UIWindow.java


注:本文中的android.widget.ImageView.setRotation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。