Questions tagged [anko]

Anko is a deprecated JetBrains library for Android application development

Anko is JetBrains library for Android application development (wrapper for Android SDK for Java), written in .

It was deprecated on the 1st of December 2019 and its use is no longer recommended.

258 questions
7
votes
2 answers

Is it possible to reuse a layout in Kotlin Anko

I read that the most benefit of using Anko is its reusability. But i could't find its exact example. Currently in the new Android layout system, the boiler plate is like below: DrawerLayout (with some setup) CoordinatorLayout (with some setup) …
ktutnik
  • 6,882
  • 1
  • 29
  • 34
6
votes
1 answer

How to change Anko alert positive/negative button color?

For example I have the next alert creation way: alert(message, title) { positiveButton(R.string.alert_dialog_btn_ok) { } }.show() I want to change the color of positive button to green, and in future set red negative…
6
votes
0 answers

Is there a simple way to get a control when it load from a xml file by using Anko in Android Studio 3.1.2?

I create a customize Preference layout, and display the UI with UIPreference.kt. I can handle the button btnClose simply by import kotlinx.android.synthetic.main.layout_preference.*. Now I hope to handle the CheckBoxPreference chAutoRestore simply,…
HelloCW
  • 843
  • 22
  • 125
  • 310
6
votes
4 answers

Accessing views from the Activity with Anko

I know I can use an id attribute with Anko to identify a view: class MainActivityUI : AnkoComponent { override fun createView(ui: AnkoContext) = with(ui) { frameLayout { textView { …
Bryan
  • 14,756
  • 10
  • 70
  • 125
6
votes
2 answers

Anko 0.8 - unresolved lparams reference

The main question is: is lparams simply gone from Anko, or am I doing something terribly wrong? The following snippet fails to compile: verticalLayout { }.lparams(width = matchParent, height = matchParent) { topMargin = dip(10) } While this…
Gustorn
  • 455
  • 3
  • 8
5
votes
1 answer

Anko doAsyncResult coroutines

I am new to anko and coroutines so excuse me if I am asking something trivial :) So what I am trying to do is have the user click a button and then I want to download a JSON from the internet, store it locally and parse it. Since both operations can…
Ioannis I
  • 298
  • 3
  • 15
5
votes
2 answers

Why does Kotlin for Android Developers (the book) need to add extensions parseList again?

I know Anko provides the functions parseSingle, parseOpt and parseList , I don't understand why the code of Android Developers (the book) need to design extensions parseList again. Could you tell me? Thanks! …
HelloCW
  • 843
  • 22
  • 125
  • 310
5
votes
4 answers

Parcel: unable to marshal value

I'm using Kotlin with Anko and I want to send to another activity a list of Players. class Player(var name: String?) { var score: Int = 0 init { this.score = 0 } } My activity: class MainActivity: AppCompatActivity() { override fun…
yasin
  • 1,297
  • 3
  • 17
  • 36
5
votes
4 answers

Could not get unknown property 'anko_version' for object of type...?

I am trying to use Anko with my Android Kotlin Project. I have added the line to my dependencies / gradle module file as follows: dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') …
arcade16
  • 1,535
  • 4
  • 23
  • 45
5
votes
2 answers

Anko equivalent to style attr in xml

I need to create borderless button. The easyest way in xml to set Widget.AppCompat.Button.Borderless. I'm trying to do this using Anko button(theme = R.style.Widget_AppCompat_Button_Borderless_Colored, text = "Send") { horizontalGravity =…
Near1999
  • 1,547
  • 2
  • 18
  • 37
5
votes
0 answers

Seems to be a bug in support design library

I'm trying to create an application with similar to Google Photos app UI. Support Libary Version = 25.1.0. The problem in that with translucent status and navigation bars, widgets inside CoorinatorLayout looks not as expected. Setting…
5
votes
2 answers

API call not working inside Anko Async

I'm trying to make an http request in Android, using Kotlin, and I've come across two ways of doing so. One is the traditional way, using AsyncTask (not really pretty) which I got to work with the following code (just the doInBackground, as the rest…
5
votes
1 answer

Anko: inner scope of apply, confusing property resolution

I'm writing an Android layout using Anko DSL. When defining a TextView, I wanted to make it center-aligned, so I wrote this: verticalLayout { textView(R.string.txt_greeting).apply { gravity = Gravity.CENTER_HORIZONTAL // <- this should…
hotkey
  • 140,743
  • 39
  • 371
  • 326
5
votes
2 answers

How Can I Mask A Password With Anko?

I realize Anko (and Kotlin) are both pretty cutting edge but I was hoping someone might be able to give me a little guidance on this. This is just a learning project for me, of course. I've got the following Kotlin code (using Anko) only very…
Onorio Catenacci
  • 14,928
  • 14
  • 81
  • 132
4
votes
1 answer

How to make indeterminateProgressDialog in Anko non cancelable?

How to make indeterminateProgressDialog non cancellable? There is a isCancelable property for alert, but seems not the case for indeterminateProgressDialog, how to solve it?
Albert Gao
  • 3,653
  • 6
  • 40
  • 69
1
2
3
17 18