【问题标题】:How do I write this Richpath code in kotlin?如何在 kotlin 中编写此 Richpath 代码?
【发布时间】:2020-05-01 21:41:14
【问题描述】:

这段代码在 java 中适用于我,但我不知道如何在 kotlin 中编写它:

richPathView.setOnPathClickListener(new RichPath.OnPathClickListener() {
    @Override
    public void onClick(RichPath richPath) {
       if (richPath.getName().equals("path_name")) {
           //TODO do an action when a specific path is clicked.
       }
    }
});

【问题讨论】:

    标签: android kotlin svg


    【解决方案1】:

    我设法解决了 Android Studio 中 IntelliJ 代码翻译器的问题

    activity_mail.xml

    <com.richpath.RichPathView
       android:id="@+id/idRichPathView"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       app:vector="@drawable/ic_map" />
    

    MainActivity.kt

    val richPathView = findViewById<RichPathView>(R.id.idRichPathView)
    
    richPathView.setOnPathClickListener { richPath ->
       if (richPath.name == "path_name") {
          //TODO do an action when a specific path is clicked.
       }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-28
      • 2011-05-03
      • 1970-01-01
      • 1970-01-01
      • 2017-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多