将一个按钮上的ImageView的 [英] Put a button over an ImageView
问题描述
我是新手的Android系统。
I'm newbie in Android.
我想知道是否有可能把一个按钮或其他部件上的ImageView的。我试着设置图像作为LinearLayout中的背景图片,但是当我横向和纵向显示模式之间切换,图像porportions改变。
I would like to know if it's possible to put a button or another component over an ImageView. I've tried setting the image as a background image of a LinearLayout, but when I change between landscape and portrait mode, the image porportions are changed.
多谢了。
推荐答案
不要把图片作为背景,你没有上的图像如何缩放任何控制。相反,创建一个RelativeLayout的,并把一个ImageView的作为孩子之一,你可以把任何东西(按钮等),其他RelativeLayout的孩子。
Don't put the image as a background, you don't have any control on how the image is scaled. Instead, create a RelativeLayout, and put an ImageView as one of the child, and you can place anything (buttons etc) as other RelativeLayout children.
<RelativeLayout ...>
<ImageView (your image) ...>
<Button (the button you want) ... />
</RelativeLayout>
这篇关于将一个按钮上的ImageView的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!