【问题标题】:Position a TextView on top of a Google Map在谷歌地图上放置一个 TextView
【发布时间】:2014-03-20 21:06:44
【问题描述】:

我正在开发一个 Xamarin Google Maps 应用程序,并希望在我的应用程序顶部和中心放置一个 TextView。

我做了一些研究,发现我不应该使用绝对布局。

最好的方法是什么?我应该使用布局吗?这可以轻松地在我的 Google 地图上运行吗?

提前致谢

【问题讨论】:

    标签: c# layout textview position xamarin


    【解决方案1】:

    使用相对布局来保存地图视图和文本视图,然后将文本视图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/>
    ...
    

    请注意,由于文本视图重叠,这可能会干扰地图视图的可用性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多