2014-02-21 133 views

回答

3

使用的FrameLayout

<FrameLayout 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content"> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/semi_transparent_background"/> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="This is my text."/> 

</FrameLayout> 

或者,你可以做一個相對佈局類似的東西。

+0

好吧,我該如何使它具有彈性?所以如果屏幕更大,TextView仍然在Imageview中(本例中爲Square)? – user3339279

+0

在這種情況下,由於TextView和ImageView填充了FrameLayout,它將相應地展開。如果這不是你的意思,你能解釋一下嗎? –

+0

我不知道如何解釋它,所以我在paint.net中做了第二個例子http://www7.pic-upload.de/22.02.14/gyo2w9p1g433.png – user3339279

3

您可以使用RelativeLayout或FrameLayout。

<RelativeLayout> 
    <ImageView> 
    <TextView> 
</Relativelayout> 

您的textview將出現在ImageView上。

2

只需在XML中從上到下排列RelativeLayout中的項目,就可以使每個項目相對於上面的其他項目向前移動。

相關問題