public class SquareImageView
extends AppCompatImageView
ImageView in order to
ensure, that its height is always equal to its width (or vice versa).| Modifier and Type | Class and Description |
|---|---|
static class |
SquareImageView.Edge
Contains all possible edges of a
SquareImageView. |
| Constructor and Description |
|---|
SquareImageView(android.content.Context context)
Creates a new square image view.
|
SquareImageView(android.content.Context context,
android.util.AttributeSet attributeSet)
Creates a new square image view.
|
SquareImageView(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
Creates a new square image view.
|
| Modifier and Type | Method and Description |
|---|---|
SquareImageView.Edge |
getScaledEdge()
Returns the edge of the image view, which is scaled in order to ensure, that width and height
are equal.
|
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec) |
void |
setScaledEdge(SquareImageView.Edge edge)
Sets the edge of the image view, which should be scaled in order to ensure, that width and
height are equal.
|
public SquareImageView(android.content.Context context)
context - The context, which should be used by the image view, as an instance of the class
Context. The context may not be nullpublic SquareImageView(android.content.Context context,
android.util.AttributeSet attributeSet)
context - The context, which should be used by the image view, as an instance of the class
Context. The context may not be nullattributeSet - The attributes of the XML tag that is inflating the view, as an instance of the type
AttributeSet or null, if no attributes are availablepublic SquareImageView(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
context - The context, which should be used by the image view, as an instance of the class
Context. The context may not be nullattributeSet - The attributes of the XML tag that is inflating the view, as an instance of the type
AttributeSet or null, if no attributes are availabledefaultStyle - The default style to apply to this view. If 0, no style will be applied (beyond what
is included in the theme). This may either be an attribute resource, whose value will
be retrieved from the current theme, or an explicit style resourcepublic SquareImageView.Edge getScaledEdge()
SquareImageView.Edge.VERTICAL, the height of the image view is
adapted to fit its width.SquareImageView.Edge. The edge may either be SquareImageView.Edge.HORIZONTAL or SquareImageView.Edge.VERTICALpublic final void setScaledEdge(SquareImageView.Edge edge)
SquareImageView.Edge.VERTICAL, the height of the image
view is adapted to fit its width.edge - The edge, which should be set, as a value of the enum SquareImageView.Edge. The edge may
either be SquareImageView.Edge.HORIZONTAL or SquareImageView.Edge.VERTICALprotected final void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)