0
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@android:color/transparent"
android:id="@+id/globeViewStreamInfoPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:id="@+id/streamIndicator"
android:src="@drawable/nv_tidestreamindicator"
android:scaleType="matrix"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_margin="10dp"
android:maxHeight="40dp"
android:maxWidth="40dp"
android:layout_width="40dp"
android:layout_height="40dp"/>
代码(streamIndicator
是ImageView
):
streamIndicatorMatrix.reset();
streamIndicatorMatrix.setScale(size,size);
// rotate indicator in the direction of the flow
streamIndicatorMatrix.setRotate((float)(stream.currentStream.direction));
streamIndicator.setImageMatrix(streamIndicatorMatrix);
当我旋转或缩放,或两者,在布局中的ImageView移动。
奇怪的是,当我setImagematrix
后上线突破,检查streamIndicator
,mTop
,mLeft
,mWidth
和mHeight
一切看起来是正确的。 size
和我的旋转角度总是合法的,合理的价值。
我只知道这是愚蠢的,我错过了什么?
谢谢!
[编辑]
这里是一个事先知情同意,红色箭头是由我添加指向错误的ImageView的:
Doh !.你知道更令人讨厌的是,如果有人问我这个问题,我会给他们这个答案!我想我最近已经投入太多时间了:)谢谢! – Simon 2013-03-17 12:22:19
你能帮助我吗? @Vladimir Mironov,.... http://stackoverflow.com/questions/32023108/android-how-to-scaley-to-based-on-other-objects-position – gumuruh 2015-08-17 00:15:38