Comments (4)
I also tried to subclass the ArrayAdapter:
listView {
adapter = object : ArrayAdapter<String>(ctx, 0, listOf("a", "b")) {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View? {
val view = with(parent) {
textView {
text = "abc"
}
}
return view
}
}
}
However, this raises an exception: addView(View) is not supported in AdapterView
. As I understand it's because the DSL calls addView
on parent
after creating the view.
from anko.
Koan currently has not special DSL for custom adapters yet.
However, it's quite simple to make your own adapters with Koan. I will modify a koan-demo-gradle project tomorrow and add some ListView-related code.
from anko.
There was a bug in Koan which made List adapter handling not obvious in the past. With Koan 0.3 there's no problem! Here's the example:
from anko.
the link to Koan does not work
from anko.
Related Issues (20)
- Alerts with no system bar, or: how to get dialog before show() ? HOT 1
- How to use linearLayout in verticalLayout? HOT 1
- hintTextColor can not work in anko? HOT 1
- Error: void org.jetbrains.anko.appcompat.v7._AlertDialogLayout.forceUniformWidth(int, int) is not being kept as e, but remapped to d
- Feature request: share file
- Android Q support
- Maybe Not update anymore for this project? HOT 1
- Maybe Not update anymore for this project? HOT 11
- Is this project discontinued? HOT 5
- Textview cannot accept new line from Resources strings HOT 2
- something issues of anko.include() dsl
- ***** BEWARE -- this project seems to be abandoned. ***** HOT 14
- Fix reference - Listeners not working HOT 1
- about Anko performance HOT 8
- Selector no cancel listener HOT 1
- textView.setMaxWidth() does not work
- Is SDK28 Available In A Repo Somewhere? HOT 1
- Style selector text? HOT 1
- Please archive this repository. HOT 3
- What if I don't want to add the view directly?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anko.