我试图把一个形象的左上角一个的LinearLayout
,但与图像边框和填充占用整个窗口的宽度。
I'm trying to put an image at the top left of a LinearLayout
, but with the image border and padding taking up the whole of the width of the window.
如果我尝试下面的XML,我得到我的形象与它的边框和跨页的整个宽度的白色背景,除了的该图像最终居中,而不会移动到左
If I try the XML below, I get my image with its border and a white background across the whole width of the page, except that the image ends up centered, and doesn't move to the left.
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:src="@drawable/banner"
android:background="@android:color/white"
android:padding="@dimen/d_8px"
/>
有没有办法,我还没有发现强制图像被抛在的ImageView
在 layout_width 设置为
FILL_PARENT
?
在平均时间,我通过删除的ImageView
在另一个的LinearLayout
,和掉落围绕这个工作一个空的的TextView
到正确的占用水平空间的其余部分。
In the mean-time I've worked around this by dropping the ImageView
inside another LinearLayout
, and dropping an empty TextView
to its right that takes up the rest of the horizontal space.
推荐答案
我有一个类似的问题,对此你今天早些时候说。难道这对屏幕设计观众由Eclipse插件并排侧与XML编辑器提供的,或者是你遇到了对齐问题时,实际运行的应用程序?如果是前者,那appers是在插件的错误,如果是后者,试着加入:
I was having a similar problem, to which you replied earlier today. Is this on "screen design" viewer provided by the Eclipse plugin side-by-side with the XML editor, or are you encountering the alignment problems when actually running the app? If the former, that appers to be a bug in the plugin, if the latter, try adding:
android:scaleType="fitStart"
这是我读过的文件,这似乎是最接近于你所需要的。
From the documentation I've read, that seems to be the closest to what you need.
相关推荐
最新文章