我需要一个屏幕,其图像沿屏幕底部放置.图像本身是固定的(来自资源).它非常大,并且按比例缩小到每个设备的宽度.我尝试使用简单的layout_alignParentBottom,如下所示:
android:id="@+id/LayoutLoading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/startup" >
android:id="@+id/ImageView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:scaleType="fitCenter"
android:src="@drawable/loading" />
是的,这没有用.除非我指定图像的确切高度(代替wrap_content),否则ImageView不会在底部对齐.这很可能是由于这样的事实,即实际图像大于屏幕尺寸,并且仅在缩小到屏幕宽度后才变为“较短”.
因此,问题是无论设备大小如何,如何使ImageView停留在屏幕底部?
解决方法:
在xml android中添加到您的imageview:adjustViewBounds =“ true”
标签:image,layout,android
来源: https://codeday.me/bug/20191031/1975937.html