2014-02-20 39 views
0

我正在開發一個Xamarin Google地圖應用程序,並且希望將TextView放置在我的應用程序頂部和中間位置。在Google地圖上放置TextView

我已經做了一些研究,我發現我不應該使用絕對佈局。

這樣做的最好方法是什麼?我應該使用佈局嗎?這會輕鬆地在我的Google地圖上工作嗎?

在此先感謝

回答

0

使用相對佈局來保存地圖視圖和TextView的,然後設置文本視圖android:layout_centerInParentandroid:layout_alignParentTop屬性true

... 
<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <FrameLayout 
     android:id="@+id/map" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 
    <TextView 
     android:text="test" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:layout_alignParentTop="true" /> 
</RelativeLayout/> 
... 

注意,這可能與干擾由於textview與它重疊,所以地圖視圖的可用性。