Android Open Source - Joetz-Android-V2 Square Image View

From Project

Back to project page Joetz-Android-V2.


The source code is released under:

GNU General Public License

If you think the Android project Joetz-Android-V2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.jens.myapplication.camps;
/* ww  w .j  av  a  2  s . c o  m*/
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

 * Created by Jens on 19/11/2014.
public class SquareImageView extends ImageView {
    public SquareImageView(Context context) {

    public SquareImageView(Context context, AttributeSet attrs) {
        super(context, attrs);

    public SquareImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth()); //Snap to width

Java Source Code List