kotlin

How to disable the keyboard when I click on EditText?

我的梦境 提交于 2020-12-31 05:58:00
问题 Hello I would like to do the next thing : when I click on an EditText I would like to hide the keyboard but seeing the cursor. I tried to do this : editText_test!!.setCursorVisible(false); editText_test!!.setFocusableInTouchMode(false); editText_test!!.setFocusable(true); Obviously I don't see the keyboard but I can't click on my EditText. How can I do this ? To be precise I am using Kotlin. Thank you ! 回答1: If you have minimum API >= 21 : editText_test!!.showSoftInputOnFocus = false To deal

How to disable the keyboard when I click on EditText?

廉价感情. 提交于 2020-12-31 05:56:04
问题 Hello I would like to do the next thing : when I click on an EditText I would like to hide the keyboard but seeing the cursor. I tried to do this : editText_test!!.setCursorVisible(false); editText_test!!.setFocusableInTouchMode(false); editText_test!!.setFocusable(true); Obviously I don't see the keyboard but I can't click on my EditText. How can I do this ? To be precise I am using Kotlin. Thank you ! 回答1: If you have minimum API >= 21 : editText_test!!.showSoftInputOnFocus = false To deal

Kotlin AutoCompleteTextView Adapter Item Selected Giving Different Value

只愿长相守 提交于 2020-12-31 05:52:08
问题 So I am working with Kotlin on this project, I mainly use Java so I'm trying to find equivalents in Kotlin to achieve the same functionality. I am getting a JSONArray from my Database and storing it in a Serializable data class called Congregation it has the following variables id: Int, name: String, language: String I now have a registration activity in which there is a "Congregation" input, I decided to make this an AutoCompleteTextView so that I could suggest possible values matching what

Kotlin and Unity development error

前提是你 提交于 2020-12-31 05:49:33
问题 I use Android Studio and Unity development, the Library packaged into aar file, and then the aar file as a Unity plug-in. When I use Java, no problem, but when using Kotlin, it will throw an exception. Thanks! Exception: AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; at com.lsl.plugin.PluginActivity.showToast(PluginActivity.kt) at com.unity3d

Kotlin and Unity development error

五迷三道 提交于 2020-12-31 05:48:36
问题 I use Android Studio and Unity development, the Library packaged into aar file, and then the aar file as a Unity plug-in. When I use Java, no problem, but when using Kotlin, it will throw an exception. Thanks! Exception: AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; at com.lsl.plugin.PluginActivity.showToast(PluginActivity.kt) at com.unity3d

Kotlin and Unity development error

心已入冬 提交于 2020-12-31 05:47:07
问题 I use Android Studio and Unity development, the Library packaged into aar file, and then the aar file as a Unity plug-in. When I use Java, no problem, but when using Kotlin, it will throw an exception. Thanks! Exception: AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; at com.lsl.plugin.PluginActivity.showToast(PluginActivity.kt) at com.unity3d

Kotlin - from a list of Maps, to a map grouped by key

戏子无情 提交于 2020-12-31 04:43:41
问题 I have a List<Map<Branch,Pair<String, Any>>> that I would like to convert in a single Map<Branch,List<Pair<String, Any>>> . So if I have an initial list with simply 2 elements : List 1. branch1 -> Pair(key1,value1) branch2 -> Pair(key2,value2) 2. branch1 -> Pair(key1a,value1a) I want to end up with : Map branch1 -> Pair(key1,value1) Pair(key1a,value1a) branch2 -> Pair(key2,value2) so a kind of groupBy, using all the values of the keys in the initially nested maps.. I have tried with list

Kotlin - from a list of Maps, to a map grouped by key

南笙酒味 提交于 2020-12-31 04:41:58
问题 I have a List<Map<Branch,Pair<String, Any>>> that I would like to convert in a single Map<Branch,List<Pair<String, Any>>> . So if I have an initial list with simply 2 elements : List 1. branch1 -> Pair(key1,value1) branch2 -> Pair(key2,value2) 2. branch1 -> Pair(key1a,value1a) I want to end up with : Map branch1 -> Pair(key1,value1) Pair(key1a,value1a) branch2 -> Pair(key2,value2) so a kind of groupBy, using all the values of the keys in the initially nested maps.. I have tried with list

Kotlin - from a list of Maps, to a map grouped by key

安稳与你 提交于 2020-12-31 04:41:28
问题 I have a List<Map<Branch,Pair<String, Any>>> that I would like to convert in a single Map<Branch,List<Pair<String, Any>>> . So if I have an initial list with simply 2 elements : List 1. branch1 -> Pair(key1,value1) branch2 -> Pair(key2,value2) 2. branch1 -> Pair(key1a,value1a) I want to end up with : Map branch1 -> Pair(key1,value1) Pair(key1a,value1a) branch2 -> Pair(key2,value2) so a kind of groupBy, using all the values of the keys in the initially nested maps.. I have tried with list

老大爷都能看懂的RecyclerView动画原理

孤人 提交于 2020-12-30 21:05:55
如何阅读本篇文章 本文主要讲解RecyclerView Layout变化触发动画执行的原理。前半部分偏重原理和代码的讲解,后半部分通过图文结合场景讲解各个阶段的执行过程。 建议先粗略阅读前半部分的原理和代码篇,做到心中有概念,带着理论知识去阅读后半部分的场景篇。最后结合全文学到的知识,带着问题去阅读源码,效果会更好。 原理篇 1. Adapter的notify方法 用过RecyclerView的同学大概都应该知道Adapter有几个notify相关的方法,它们分别是: notifyDataSetChanged() notifyItemChanged(int) notifyItemInserted(int) notifyItemRemoved(int) notifyItemRangeChanged(int, int) notifyItemRangeInserted(int, int) notifyItemRangeRemoved(int, int) notifyItemMoved(int, int) 稍微有点开发经验的同学都知道,notifyDataSetChanged()方法比其它的几个方法更重量级一点,它会导致整个列表刷新,其它几个方法则不会。有更多开发经验的同学可能还知道notifyDataSetChanged()方法不会触发RecyclerView的动画机制