0
我目前使用的庫TouchImageView這裏:Android:Square TouchImageView?
https://github.com/MikeOrtiz/TouchImageView
時,我充滿了整個手機與TouchImageView屏幕這工作完全正常,但我會如何限制可視面積爲正方形?
我已經試過:
public class SquareTouchImageView extends TouchImageView {
public SquareTouchImageView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public SquareTouchImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquareTouchImageView(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = getMeasuredWidth();
setMeasuredDimension(width, width);
}
}
但是,這並不讓我向下滾動,顯示圖像的其餘部分(如果它長得比它寬)
有沒有一種方法,我可以啓用方形TouchImageView?
如果是這樣,我怎麼能做到這一點?
您是否嘗試過簡單地把一個 「機器人:的onclick = [()函數]」 直接對XML的ImageView的? – durbnpoisn
是的,這並沒有幫助,基本上,由於某種原因,TouchImageView中的圖像被錨定在錯誤的位置。 –
作爲另一種想法,您可以製作完全透明的PNG,並將其固定在任何位置 - 有效製作傳感器。 – durbnpoisn