2012-12-10 63 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

相關問題