大约有 850 项符合查询结果(耗时:0.0116秒) [XML]
How should I handle “No internet connection” with Retrofit on Android
...
Replace Java with Kotlin if you're tired of NPEs and other syntax limitations/pain
– Louis CAD
Jun 25 '18 at 13:38
add...
How to make part of the text Bold in android at runtime?
...
You can do it using Kotlin and buildSpannedString extension function from core-ktx
holder.textView.text = buildSpannedString {
bold { append("$name\n") }
append("$experience $dateOfJoining")
}
...
Multi-line EditText with Done action button
...
To do this in Kotlin (and also optionally apply other configurations like textCapSentences you can use this extension function:
// To use this, do NOT set inputType on the EditText in the layout
fun EditText.setMultiLineCapSentencesAndDon...
Fragment over another fragment issue
...
Kotlin version: root.setOnTouchListener { _, _ -> true}
– Gal Rom
Oct 29 '19 at 19:57
add a comme...
Regular expression to find URLs within a string
...
Kotlin val urlRegex = "(?:(?:https?|ftp):\\/\\/)?[\\w/\\-?=%.]+\\.[\\w/\\-?=%.]+"
– Akshay Nandwana
Feb 27 '19 at 6:32
...
What is the best way to tell if a character is a letter or number in Java without using regexes?
...
On Kotlin it is much simpler if (c in 'a'..'z' || с in 'A'..'Z' || c in '0'..'9')
– Vlad
Jul 14 at 7:58
...
Android - get children inside a View?
...pdate for those who come across this question after 2018, if you are using Kotlin, you can simply use the Android KTX extension property ViewGroup.children to get a sequence of the View's immediate children.
share
|...
Android; Check if file exists without creating a new one
...
Kotlin Extension Properties
No file will be create when you make a File object, it is only an interface.
To make working with files easier, there is an existing .toFile function on Uri
You can also add an extension propert...
How do I get the file extension of a file in Java?
...;
Gradle Groovy DSL
implementation 'commons-io:commons-io:2.6'
Gradle Kotlin DSL
implementation("commons-io:commons-io:2.6")
Others https://search.maven.org/artifact/commons-io/commons-io/2.6/jar
share
|
...
How do I detect if I am in release or debug mode?
... ( getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE ) );
Kotlin:
val isDebuggable = 0 != applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE
It is taken from bundells post from here
share
...