android textview 在 android 4.4.2 中的 map fragment 上不可见,但在 Lollipop 设备中可见

标签 android textview android-4.4-kitkat supportmapfragment

我正在使用 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/

相关文章:

android - 如何在 init.rc 文件中完全禁用 Android L 中的 SELinux?

android - 在android中,如何从代码更改Daydream的设置?

android - ChildFragmentManager.findFragmentByID() 在 android 4.4.2 上返回 null

java - 以编程方式设置 imageview 前景渐变颜色

android - Android 中的 TextView 滚动和动画

android - ScrollView 滚动,但不完全显示其内容

android - TextView 中的多个点击跨度

android - 使用静态库创建 PhoneGap 插件

android - 我如何将行内的小部件居中?

android - 底部导航 View 显示不正确