Shl*_*rtz 8 events android image matrix onready
myImageView.getImageMatrix()一旦我的活动准备就绪,我正试图从方法中获取值.我尝试使用onCreate(),onStart(),onResume()方法,但我得到的矩阵是默认的.
如果我调用myImageView.getImageMatrix()OnClickListener触发,在我的活动可见后,我会得到正确的值.
为了更清楚:
调用getImageMatrix onStart = Matrix{[1.0, 0.0, 0.0][0.0, 1.0,
0.0][0.0, 0.0, 1.0]}
调用getImageMatrix onClick = Matrix{[0.77488154, 0.0,
7.6717987][0.0, 0.77488154, 0.0][0.0, 0.0,
1.0]}
Lum*_*mis 16
您也可以尝试这种方法:
ImageView myImageView = (ImageView) findViewById(R.id.myImageView);
ViewTreeObserver vto = myImageView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// do something now when the object is loaded
// e.g. find the real size of it etc
myImageView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5636 次 |
| 最近记录: |