2012-12-10 64 views
0

我想要安装图像,并在其下方安排一些黑色背景和白色文本。我的问题是,布局最终的图像和文字本身之间留有空间,我不明白为什么:Android:在图像下方添加文本

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 

    <ImageView 
     android:id="@+id/image" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:scaleType="fitStart" /> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="15dp" 
     android:layout_below="@+id/image" > 

     <TextView 
      style="@style/text_overlay" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 

     <!-- Couple more elements --> 

    </RelativeLayout> 
</RelativeLayout> 

我想的15dp触碰图像的底部本次RelativeLayout的,但除非我将图像高度改为小一点,会留下一些空间。此布局指定如何显示图像+其下的一些文本,但总共有4个图像使用此布局在屏幕上以2x2显示加载。 (每张图片占用25%的屏幕)。

任何想法如何使RelativeLayout准确地与图像的底部对齐吗?

回答

0

我不完全明白你的问题,虽然我想你可能看看发射布局我的报纸拼图的应用程序...

从打开数独

或许游戏看数字键盘布局在这里找到:

使用ADT工具获得正确的布局可能是最好的,如果可能的话,但我知道有时难以获得特定的结果我仍然推荐使用Android开发工具中包含的xml工具。

+0

嗯,我想有一个图像,而下方认为需要它的宽一些文本/图片(某种布局)。布局在两者之间留下间距/填充。 – user1777907

相关问题