0
我试图通过getLeft()方法在代码中打印ImageView的位置,只是为了查看它是否返回正确的值(它是80),并且logcat返回了192个。getLeft()返回错误的值
ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/image1"
android:layout_gravity="center_horizontal"
android:src="@drawable/image1"
android:layout_marginLeft="80dp"/>
打印命令:
public void onWindowFocusChanged (boolean hasFocus){
super.onWindowFocusChanged(hasFocus);
if(hasFocus){
a = (ImageView)findViewById(R.id.image1);
Log.v(LOGS, "image a = " + a.getLeft());
}
}