如何获取android:layout_width="match_parent"这种控件的宽度呢
纯净水o 2015-09-07 02:32:24 我创建了一个位图控件
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/abc_ab_share_pack_holo_light" />
如上的属性
我想在程序中读取这个位图的宽和高
我使用了如下的语句
iv = (ImageView)this.findViewById(R.id.imageView1);
Toast.makeText(this,String.valueOf(iv.getWidth()) + "*" + String.valueOf(iv.getHeight()), 1).show();
发现打印的结果是0*0
我如何才能在程序中获取它的宽度和高度呢???