DJI Mobile SDK Documentation
      包:dji.open.pilot.base.ui.cameraview
      classSince MSDK 5.20.1

      DrawingTextInfo

      自定义文字叠加信息,用于在图传画面上实时叠加显示文字。

      Package dji.open.pilot.base.ui.cameraviewAndroid · Java / Kotlin

      自定义文字叠加信息,用于在图传画面上实时叠加显示文字。

      MSDK 5.20.1开始支持

      成员

      15 个成员

      方法

      15

      Members

      method

      ALIGN_LEFT

      static final int ALIGN_LEFT   = 0

      水平对齐:锚点为文字左边界。

      method

      ALIGN_CENTER

      static final int ALIGN_CENTER = 1

      水平对齐:锚点为文字水平中心。

      method

      ALIGN_RIGHT

      static final int ALIGN_RIGHT  = 2

      水平对齐:锚点为文字右边界。

      method
      method

      getAnchor

      Since MSDK 5.20.1
      OpenPoint getAnchor() 

      获取文字锚点坐标。

      返回值

      类型说明
      OpenPoint锚点坐标(归一化,0.0~1.0),水平方向含义由 horizontalAlignment 决定,垂直方向固定为文字整体的垂直中心。
      method
      method

      setAnchor

      Since MSDK 5.20.1
      void setAnchor(OpenPoint anchor) 

      设置文字锚点坐标。

      参数

      名称类型说明
      anchorOpenPoint 锚点坐标(归一化,0.0~1.0),水平方向含义由 horizontalAlignment 决定,垂直方向固定为文字整体的垂直中心。
      method
      method

      getText

      Since MSDK 5.20.1
      String getText() 

      获取文字内容。

      返回值

      类型说明
      String文字内容,支持 \n 换行,空字符串时不绘制。
      method
      method

      setText

      Since MSDK 5.20.1
      void setText(String text) 

      设置文字内容。

      参数

      名称类型说明
      textString 文字内容,支持 \n 换行,空字符串时不绘制。
      method

      getTextSize

      Since MSDK 5.20.1
      float getTextSize() 

      获取字号。

      返回值

      类型说明
      float字号(单位 sp)。
      method

      setTextSize

      Since MSDK 5.20.1
      void setTextSize(float textSize) 

      设置字号。

      参数

      名称类型说明
      textSizefloat 字号(单位 sp)。
      method

      getTextColor

      Since MSDK 5.20.1
      int getTextColor() 

      获取文字颜色。

      返回值

      类型说明
      int文字颜色(ARGB)。
      method

      setTextColor

      Since MSDK 5.20.1
      void setTextColor(int textColor) 

      设置文字颜色。

      参数

      名称类型说明
      textColorint 文字颜色(ARGB)。
      method

      getBackgroundColor

      Since MSDK 5.20.1
      int getBackgroundColor() 

      获取文字背景色。

      返回值

      类型说明
      int文字背景色(ARGB),alpha 通道为 0 时不绘制背景。
      method

      setBackgroundColor

      Since MSDK 5.20.1
      void setBackgroundColor(int backgroundColor) 

      设置文字背景色。

      参数

      名称类型说明
      backgroundColorint 文字背景色(ARGB),alpha 通道为 0 时不绘制背景。
      method

      getHorizontalAlignment

      Since MSDK 5.20.1
      int getHorizontalAlignment() 

      获取水平对齐方式。

      返回值

      类型说明
      int水平对齐方式,取值为 ALIGN_LEFT、ALIGN_CENTER、ALIGN_RIGHT。
      method

      setHorizontalAlignment

      Since MSDK 5.20.1
      void setHorizontalAlignment(int horizontalAlignment) 

      设置水平对齐方式。

      参数

      名称类型说明
      horizontalAlignmentint 水平对齐方式,取值为 ALIGN_LEFT、ALIGN_CENTER、ALIGN_RIGHT。