我的ImageView在XML:ImageView的回報爲零的getWidth
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ivManagePhoto"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
我的代碼:
ImageView ivManagePhoto;
ivManagePhoto = (ImageView)findViewById(R.id.ivManagePhoto);
double ivw = ivManagePhoto.getWidth();
當我試圖讓ivManagePhoto.getWidth();返回0,但我需要得到mathparent大小。
想要屏幕寬度尺寸? – Manishika
@ Manishika,屏幕寬度尺寸= 480,寬度imageView =〜400。我需要得到這個400 – user3712384