【问题标题】:Add seek bar on map using Map API V2 in android在 android 中使用 Map API V2 在地图上添加搜索栏
【发布时间】:2013-01-17 11:13:33
【问题描述】:

我正在开发一个使用 Google Map Api V2 的应用程序,地图已成功加载,我也在其上放置了标记,但现在当我尝试在我的地图上添加搜索栏时,它没有显示地图的表面,实际上我想提供一个功能,用户可以使用搜索栏增加和减少圆的半径,但是当我通过 XML 添加搜索栏时,它没有显示搜索栏,

我的 XML 就是这样的:-

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <RadioGroup
        android:id="@+id/rg_views"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <RadioButton
            android:id="@+id/rb_normal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="StreetView" />

        <RadioButton
            android:id="@+id/rb_satellite"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Satellite" />

        <RadioButton
            android:id="@+id/rb_terrain"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Terrian" />
    </RadioGroup>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/rg_views" >

        <fragment
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            class="com.google.android.gms.maps.SupportMapFragment" />

        <SeekBar
            android:id="@+id/bar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="-30dp"
            android:max="400"
            android:minWidth="100dp"
            android:progress="100"
            android:rotation="270" />
    </RelativeLayout>

</RelativeLayout>

如果有人知道如何放置按钮,请在地图表面寻找栏,然后请帮助我

谢谢

【问题讨论】:

  • 尝试上传您的 XML 文件内容,这将有助于找到问题的根源
  • 嗨@Noloxs,我已经添加了我的xml,请回复....
  • 我认为这是旋转的问题。我尝试了不同的实现,但从未让它垂直工作。尝试不旋转,看看它是否出现。
  • @Doctoror Drive 是的,感谢它的工作,但为什么它在垂直时没有显示,我看不到它背后的任何逻辑......
  • 你现在可以了@Doctoror Drive............

标签: android google-maps-api-2 google-maps-android-api-2


【解决方案1】:

SeekBar 是为水平而设计的。旋转它会使它在不修改代码的情况下正确显示。您可以尝试垂直 SeekBar 实现的示例,但没有一个对我有用。

How can I get a working vertical SeekBar in Android?

http://hackskrieg.wordpress.com/2012/04/20/working-vertical-seekbar-for-android/

【讨论】:

    猜你喜欢
    • 2019-03-04
    • 2013-08-14
    • 2013-03-07
    • 1970-01-01
    • 2016-04-21
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 2013-07-21
    相关资源
    最近更新 更多