我有一个xml布局,它将图像放置在屏幕顶部,一些文本放在底部。在两者之间我有一个画廊插件,我用图像填充大小相同获取android布局参数'MATCH_PARENT'实际值
的理由为这,就是我可以调用 .setLayoutParams(new Gallery.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)和画廊图像将适合插图中的图像和文字完美的空间。
我遇到的问题是我不希望图像变得太大。对于小分辨率,填写父母是好的。当分辨率增加时,图像变得太大,我需要一个200-300DP左右的“帽子”。
有没有办法获得LayoutParam.MATCH_PARENT的整数值?那么我可以执行比较并限制大小。
编辑 - 代码
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/chooseanimage" />
android:id="@+id/rlayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_width="wrap_content"
an