Kotlin/anko — dự án di động — đang có 15.8k sao GitHub trong nhóm Mobile. Pleasant Android application development
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
:warning: Anko is deprecated. Please see this page for more information.
Anko is a Kotlin library which makes Android application development faster and easier. It makes your code clean and easy to read, and lets you forget about rough edges of the Android SDK for Java.
Anko consists of several parts:
Anko Commons: a lightweight library full of helpers for intents, dialogs, logging and so on;
Anko Layouts: a fast and type-safe way to write dynamic Android layouts;
Anko SQLite: a query DSL and parser collection for Android SQLite;
Anko Coroutines: utilities based on the kotlinx.coroutines library.
Anko Commons
Anko Commons is a "toolbox" for Kotlin Android developer. The library contains a lot of helpers for Android SDK, including, but not limited to:
Intents (wiki);
Dialogs and toasts (wiki);
Logging (wiki);
Resources and dimensions (wiki).
Anko Layouts (wiki)
Anko Layouts is a DSL for writing dynamic Android layouts. Here is a simple UI written with Anko DSL:
verticalLayout {
val name = editText()
button("Say Hello") {
onClick { toast("Hello, ${name.text}!") }
}
}
The code above creates a button inside a LinearLayout and attaches an OnClickListener to that button. Moreover, onClick accepts a suspend lambda, so you can write your asynchronous code right inside the listener!
Note that this is the complete layout code. No XML is required!
Anko has a DSL for ConstraintLayout since v0.10.4
There is also a plugin for Android Studio that supports previewing Anko DSL layouts.
Anko SQLite (wiki)
Have you ever been tired of parsing SQLite query results using Android cursors? Anko SQLite provides lots of helpers to simplify working with SQLite databases.
For example, here is how you can fetch the list of users with a particular name:
Anko Coroutines is based on the kotlinx.coroutines library and provides:
bg() function that executes your code in a common pool.
asReference() function which creates a weak reference wrapper. By default, a coroutine holds references to captured objects until it is finished or canceled. If your asynchronous framework does not support cancellation, the values you use inside the asynchronous block can be leaked. asReference() protects you from this.
Using Anko
Gradle-based project
Anko has a meta-dependency which plugs in all available features (including Commons, Layouts, SQLite) into your project at once:
Make sure that you have the $anko_version settled in your gradle file at the project level:
ext.anko_version='0.10.8'
If you only need some of the features, you can reference any of Anko's parts:
dependencies {
// Anko Commons
implementation "org.jetbrains.anko:anko-commons:$anko_version"
// Anko Layouts
implementation "org.jetbrains.anko:anko-sdk25:$anko_version" // sdk15, sdk19, sdk21, sdk23 are also available
implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
// Coroutine listeners for Anko Layouts
implementation "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
implementation "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"
// Anko SQLite
implementation "org.jetbrains.anko:anko-sqlite:$anko_version"
}
There are also a number of artifacts for the Android support libraries:
There is an example project showing how to include Anko library into your Android Gradle project.
IntelliJ IDEA project
If your project is not based on Gradle, just attach the required JARs from the jcenter repository as the library dependencies and that's it.
Contributing
The best way to submit a patch is to send us a pull request. Before submitting the pull request, make sure all existing tests are passing, and add the new test if it is required.
If you want to add new functionality, please file a new proposal issue first to make sure that it is not in progress already. If you have any questions, feel free to create a question issue.
Instructions for building Anko are available in the Wiki.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/Kotlin/anko là nguồn chính thức.
Kotlin/anko có bao nhiêu sao?
Kotlin/anko có 15.8k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/Kotlin/anko. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
Kotlin/anko có những chủ đề gì?
GitHub topics của Kotlin/anko: "android", "kotlin". TopGit xếp repo vào nhóm Mobile.
Kotlin/anko có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho Kotlin/anko. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
Kotlin/anko còn đang phát triển không?
Commit gần nhất trên Kotlin/anko là 7.0 năm trước (theo timestamp GitHub). Repo có 1.3k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Kotlin/anko dùng license gì?
Kotlin/anko phát hành theo license Apache-2.0. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
Kotlin/anko viết bằng ngôn ngữ gì?
Kotlin/anko chủ yếu viết bằng Kotlin. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
anko có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về anko.