大约有 366 项符合查询结果(耗时:0.0308秒) [XML]

https://stackoverflow.com/ques... 

Android LinearLayout Gradient Background

... With Kotlin you can do that in just 2 lines Change color values in the array val gradientDrawable = GradientDrawable( GradientDrawable.Orientation.TOP_BOTTOM, int...
https://stackoverflow.com/ques... 

Is there an easy way to strike through text in an app widget?

... Here is an extension for all you Kotlin folks fun TextView.showStrikeThrough(show: Boolean) { paintFlags = if (show) paintFlags or Paint.STRIKE_THRU_TEXT_FLAG else paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv() } Usage tex...
https://stackoverflow.com/ques... 

How to disable copy/paste from/to EditText

... Kotlin solution: fun TextView.disableCopyPaste() { isLongClickable = false setTextIsSelectable(false) customSelectionActionModeCallback = object : ActionMode.Callback { override fun onCreateActionMode(mod...
https://stackoverflow.com/ques... 

How can I change the color of a part of a TextView?

... Here solution in Kotlin that uses SpannableString to change color of part of a string. val phoneCodeColor = ContextCompat.getColor(this, R.color.myColor) val text = SpannableStringBuilder() .color(phoneCodeColor) { append("${ ...
https://stackoverflow.com/ques... 

How to pass arguments from command line to gradle

... ./gradlew printPet --pet="puppies" output: Puppies! are awesome! Kotlin solution open class PrintPet : DefaultTask() { @Suppress("UnstableApiUsage") @set:Option(option = "pet", description = "The cute pet you would like to print out") @get:Input var pet: String = "" ...
https://stackoverflow.com/ques... 

How to convert a color integer to a hex String in Android?

...d-up with missed zeros when you convert colors like 0xFF000123. Here is my kotlin based solution which doesn't require neither android specific classes nor java. So you could use it in multiplatform project as well: fun Int.toRgbString(): String = "#${red.toStringComponent()}${green.to...
https://stackoverflow.com/ques... 

Android webview launches browser when calling loadurl

... myWebView.webViewClient = WebViewClient() in Kotlin! – Thomas Pritchard Apr 24 '18 at 12:32 add a comment  |  ...
https://stackoverflow.com/ques... 

How to check if APK is signed or “debug build”?

... ( getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE ) ); Kotlin: val isDebuggable = 0 != applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE For more information, please see Securing Android LVL Applications. Alternatively, if you're using Gradle correctly, you can check ...
https://stackoverflow.com/ques... 

Implicit “Submit” after hitting Done on the keyboard at the last EditText

... Simple and effective solution with Kotlin Extend EditText: fun EditText.onSubmit(func: () -> Unit) { setOnEditorActionListener { _, actionId, _ -> if (actionId == EditorInfo.IME_ACTION_DONE) { func() } true } ...
https://stackoverflow.com/ques... 

How do we use runOnUiThread in Android?

...k method runs in UI thread so don't need to use runOnUiThread here. Using Kotlin While in Activity, this.runOnUiThread { // Do stuff } From Fragment, activity?.runOnUiThread { // Do stuff } Using Java, this.runOnUiThread(new Runnable() { void run() { // Do stuff ...