You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
88 lines
2.9 KiB
Java
88 lines
2.9 KiB
Java
|
|
package android.widget;
|
||
|
|
|
||
|
|
import android.util.AttributeSet;
|
||
|
|
import android.content.Context;
|
||
|
|
|
||
|
|
import android.view.View;
|
||
|
|
|
||
|
|
public class ImageView extends View {
|
||
|
|
public ImageView(AttributeSet attrs) {
|
||
|
|
super(attrs);
|
||
|
|
|
||
|
|
native_constructor(attrs);
|
||
|
|
}
|
||
|
|
|
||
|
|
public ImageView(Context context) {
|
||
|
|
super(context);
|
||
|
|
|
||
|
|
native_constructor(context);
|
||
|
|
}
|
||
|
|
|
||
|
|
private native void native_constructor(AttributeSet attrs);
|
||
|
|
private native void native_constructor(Context context);
|
||
|
|
|
||
|
|
public /*native*/ void setImageResource(final int resid) {}
|
||
|
|
public void setAdjustViewBounds(boolean adjustViewBounds) {}
|
||
|
|
|
||
|
|
public void setScaleType(ScaleType scaleType) {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Options for scaling the bounds of an image to the bounds of this view.
|
||
|
|
*/
|
||
|
|
public enum ScaleType {
|
||
|
|
/**
|
||
|
|
* Scale using the image matrix when drawing. The image matrix can be set using
|
||
|
|
* {@link ImageView#setImageMatrix(Matrix)}. From XML, use this syntax:
|
||
|
|
* <code>android:scaleType="matrix"</code>.
|
||
|
|
*/
|
||
|
|
MATRIX (0),
|
||
|
|
/**
|
||
|
|
* Scale the image using {@link Matrix.ScaleToFit#FILL}.
|
||
|
|
* From XML, use this syntax: <code>android:scaleType="fitXY"</code>.
|
||
|
|
*/
|
||
|
|
FIT_XY (1),
|
||
|
|
/**
|
||
|
|
* Scale the image using {@link Matrix.ScaleToFit#START}.
|
||
|
|
* From XML, use this syntax: <code>android:scaleType="fitStart"</code>.
|
||
|
|
*/
|
||
|
|
FIT_START (2),
|
||
|
|
/**
|
||
|
|
* Scale the image using {@link Matrix.ScaleToFit#CENTER}.
|
||
|
|
* From XML, use this syntax:
|
||
|
|
* <code>android:scaleType="fitCenter"</code>.
|
||
|
|
*/
|
||
|
|
FIT_CENTER (3),
|
||
|
|
/**
|
||
|
|
* Scale the image using {@link Matrix.ScaleToFit#END}.
|
||
|
|
* From XML, use this syntax: <code>android:scaleType="fitEnd"</code>.
|
||
|
|
*/
|
||
|
|
FIT_END (4),
|
||
|
|
/**
|
||
|
|
* Center the image in the view, but perform no scaling.
|
||
|
|
* From XML, use this syntax: <code>android:scaleType="center"</code>.
|
||
|
|
*/
|
||
|
|
CENTER (5),
|
||
|
|
/**
|
||
|
|
* Scale the image uniformly (maintain the image's aspect ratio) so
|
||
|
|
* that both dimensions (width and height) of the image will be equal
|
||
|
|
* to or larger than the corresponding dimension of the view
|
||
|
|
* (minus padding). The image is then centered in the view.
|
||
|
|
* From XML, use this syntax: <code>android:scaleType="centerCrop"</code>.
|
||
|
|
*/
|
||
|
|
CENTER_CROP (6),
|
||
|
|
/**
|
||
|
|
* Scale the image uniformly (maintain the image's aspect ratio) so
|
||
|
|
* that both dimensions (width and height) of the image will be equal
|
||
|
|
* to or less than the corresponding dimension of the view
|
||
|
|
* (minus padding). The image is then centered in the view.
|
||
|
|
* From XML, use this syntax: <code>android:scaleType="centerInside"</code>.
|
||
|
|
*/
|
||
|
|
CENTER_INSIDE (7);
|
||
|
|
|
||
|
|
ScaleType(int ni) {
|
||
|
|
nativeInt = ni;
|
||
|
|
}
|
||
|
|
final int nativeInt;
|
||
|
|
}
|
||
|
|
}
|