我正在使用 SupportMapFragment
map 显示开发 Android 应用程序
map 工作正常,问题是 textView
,我想在 MapFragment 上显示一些文本,我定义了这样的布局:
gpsTxtView=(TextView)findViewById(R.id.GPS);
设置文本如下:
gpsTxtView.setText("最后一次停止:\n"+ new SimpleDateFormat("MMM dd yyyy hh:mm:ss").format(date));
以及相应的 xml:
`<FrameLayout
android:id="@+id/mapLL"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/tool_bar_detail"
layout="@layout/tool_bar_detail"
android:layout_width="match_parent"
android:layout_height="48sp" />
<fragment
android:id="@+id/detailMap"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/GPS"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:layout_marginBottom="30sp"
android:layout_marginLeft="5sp"
android:text=""
android:textColor="@android:color/holo_red_dark"
android:textSize="16sp"
android:textStyle="bold" />
</FrameLayout> `
就像我们通常做的事情一样,我无法弄清楚为什么它不能在 android 4.4.2 (micromax p480 Tab) 中工作,并且在 android lollipop (yu Yureka) 中工作,如果有人为此提出一些解决方案,我们将不胜感激。 谢谢。
最佳答案
我只是检查你的代码。代码中的一切都很好。因此,为了测试你可以做一件事。输入一些硬编码值,然后检查值是否反射(reflect)在 TextView 中。因此,您可以得出结论,您获取数据的方式可能存在问题。
如果您在数据中获取日期,我还想建议一件事。然后传递区域设置,这可能是一个问题。
关于android textview 在 android 4.4.2 中的 map fragment 上不可见,但在 Lollipop 设备中可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34081313/