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

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

How to get the ActionBar height?

...mplexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics()); } Kotlin: val tv = TypedValue() if (requireActivity().theme.resolveAttribute(android.R.attr.actionBarSize, tv, true)) { val actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, resources.displayMetrics) } ...
https://stackoverflow.com/ques... 

SharedPreferences.onSharedPreferenceChangeListener not being called consistently

... Kotlin Code for register SharedPreferenceChangeListener it detect when change will happening on the saved key : PreferenceManager.getDefaultSharedPreferences(this) .registerOnSharedPreferenceChangeListener { share...
https://stackoverflow.com/ques... 

Send Email Intent

...m")); startActivity(Intent.createChooser(emailIntent, "Send feedback")); Kotlin version val emailIntent = Intent(Intent.ACTION_SENDTO).apply { data = Uri.parse("mailto:abc@xyz.com") } startActivity(Intent.createChooser(emailIntent, "Send feedback")) This was my output (only Gmail + Inbox su...
https://stackoverflow.com/ques... 

Convert Bitmap to File

...oo short not fulfilling the purpose. For those how are looking for Java or Kotlin code to Convert bitmap to File Object. Here is the detailed article I have written on the topic. Convert Bitmap to File in Android public static File bitmapToFile(Context context,Bitmap bitmap, String fileNameToSave) {...
https://stackoverflow.com/ques... 

How to change the status bar color in Android?

...atusBarColor" tools:targetApi="lollipop">@color/black</item> For Kotlin Developers: window.statusBarColor = ContextCompat.getColor(this, R.color.color_name) share | improve this answer ...
https://stackoverflow.com/ques... 

How to remove focus without setting focus to another control?

... @Levit, you've probably found it by now, but Kotlin. – prodaea Sep 11 '16 at 19:08  |  show 3 more comments ...
https://stackoverflow.com/ques... 

How to display long messages in logcat

... Here is a Kotlin version for the @spatulamania answer (especially for lazy/smart peooples): val maxLogSize = 1000 val stringLength = yourString.length for (i in 0..stringLength / maxLogSize) { val start = i * maxLogSize var en...
https://stackoverflow.com/ques... 

android.widget.Switch - on/off event listener?

... For those using Kotlin, you can set a listener for a switch (in this case having the ID mySwitch) as follows: mySwitch.setOnCheckedChangeListener { _, isChecked -> // do whatever you need to do when the switch is toggled her...
https://stackoverflow.com/ques... 

Operator overloading in Java

...based) language which does support operator overloading, you could look at Kotlin or Groovy. Alternatively, you might find luck with a Java compiler plugin solution. share | improve this answer ...
https://stackoverflow.com/ques... 

Set inputType for an EditText Programmatically?

... For Kotlin: val password = EditText(this) password.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD password.hint = "Password"