UX SDK中控件不显示

评论

7 条评论

  • 尊敬的开发者, 您好,感谢您联系DJI 大疆创新。 RadarWidget 已经定义在一个 LinearLayout 中,但你为它提供了约束布局(ConstraintLayout)专用的属性(如 app:layout_constraintEnd_toEndOf="parent")。这些属性在 LinearLayout 中是无效的,因为 LinearLayout 使用的是线性排列逻辑,而不是约束。可以尝试将 LinearLayout 改为其他适合使用约束属性的布局(如 ConstraintLayout),或去除冗余的属性,只使用 LinearLayout 支持的属性。 不过在sample中,RadarWidget里大部分代码都被注释了,已经不可用了,这个控件更新了,新的控件叫做HorizontalSituationIndicatorWidget 希望我们的解决方案能够帮到您,感谢您的邮件,祝您生活愉快! Best Regards, DJI 大疆创新SDK技术支持
    0
    评论操作 固定链接
  • 请求 #134923“UXSDK 不显示”已被关闭,并已合并到此请求。请求 #134923 中的最后评论: 为什么这个控件在手机上不显示呢,还有其他很多控件也不显示,是因为没有连接无人机吗?
    0
    评论操作 固定链接
  • 修改后,还是没有任何显示
    0
    评论操作 固定链接
  • ccc
    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="start"
    android:orientation="vertical"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintStart_toStartOf="parent">

    <dji.v5.ux.core.widget.airsense.AirSenseWidget
    android:id="@+id/widget_air_sense"
    android:layout_width="22dp"
    android:layout_weight="1"
    android:layout_height="wrap_content" />


    <dji.v5.ux.core.widget.battery.BatteryWidget
    android:id="@+id/widget_battery"
    android:layout_width="100dp"
    android:layout_height="200dp"
    android:layout_weight="2"
    app:uxsdk_voltageVisibility="true"
    android:visibility="visible"

    />
    <dji.v5.ux.core.widget.hsi.HorizontalSituationIndicatorWidget
    android:layout_width="340dp"
    android:layout_height="160dp"
    android:layout_weight="2"
    android:visibility="visible" />

    </LinearLayout> 只有最下面一个控件显示出来了

     

    0
    评论操作 固定链接
  • 尊敬的开发者, 您好,感谢您联系DJI 大疆创新。 您可以参考MSDK sample中的uxsdk的实现,它是一个开源的框架。 只有最下面一个控件显示出来了 1、LinearLayout 方向和 layout_weight 的影响 - LinearLayout 有水平(android:orientation="horizontal")和垂直(android:orientation="vertical")两种方向。从你给出的代码看,没有指定 LinearLayout 的方向,默认是水平方向。在水平方向下,控件的 layout_weight 会和 layout_width 共同影响控件的实际宽度;在垂直方向下,则会和 layout_height 共同影响实际高度。 - 明确 LinearLayout 方向:在 LinearLayout 标签中添加 android:orientation 属性,根据需求设置为 horizontal 或 vertical。 2、布局空间不足、布局重叠 - LinearLayout 的大小由其子控件的大小决定,也受父布局的限制。如果父布局空间有限,而子控件设置的宽度或高度总和超出了父布局的可用空间,就可能导致部分控件被裁剪或隐藏。 - 如果布局中存在重叠,后添加的控件会覆盖前面的控件。在你的布局里,若 LinearLayout 空间不足以按设定尺寸和权重正常显示三个控件,后面的控件就可能遮挡前面的控件。 - 根据布局方向和实际需求,调整控件的 `layout_weight` 和固定尺寸,确保控件能合理分配空间。 - 调试布局:使用 Android Studio 的布局编辑器或布局检查工具,查看布局的层次结构和控件的实际大小,帮助定位问题。 希望我们的解决方案能够帮到您,感谢您的邮件,祝您生活愉快! Best Regards, DJI 大疆创新SDK技术支持
    0
    评论操作 固定链接
  • 只有最下面一个控件显示出来了 这个例子,哪里还有错误,空间也占用了,就是不显示,可以给出一个可以运行的示例吗。
    0
    评论操作 固定链接
  • 尊敬的开发者, 您好,感谢您联系DJI 大疆创新。 这需要您自行解决了。 MSDK v5的sample中就有集成UXSDK,UXSDK就是开源框架,包含了UI控件以及示例页面,您可以参考。 运行MSDK sample教程:https://developer.dji.com/doc/mobile-sdk-tutorial/cn/quick-start/run-sample.html MSDK sample code: https://github.com/dji-sdk/Mobile-SDK-Android-V5 感谢您的邮件,祝您生活愉快! Best Regards, DJI 大疆创新SDK技术支持
    0
    评论操作 固定链接

请先登录再写评论。