android query框架demo,GitHub - Vurtex/AQuery: 非常方便的开源框架(Android-Query)

The popularity of jQuery comes down to one simple fact; it significantly reduces the amount of code needed to perform asynchronous tasks and manipulate the DOM. The new project AQuery seeks to do the same thing for Android developers working. To show you what Android Query can do for UI development, we cite a sample from their project page.

Before

7f24c3db673870b565e8d29f084a3726.png

After

9f64a0d39a750ad95c9059b03265c09a.png

Android Query simplifies attaching event handlers. Rather than building out an interface or anonymous class, one simply needs to ensure they don’t misspell the event handler’s method name.

aq.id(R.id.button).clicked(this, "buttonClicked");

Fragmentation due to differences in screen size and API versions can make getting the most out of a device difficult. Android Query some of these issues by providing its own wrappers around the API. For example, the function “aq.hardwareAccelerated11();” will detect whether or not the device supports API 11 and enable hardware acceleration if appropriate.

When working with different screens sizes, one often starts with a tablet and then removes and reorganizes controls until it fits on a phone. Normally this means you have to inspect the visual tree to see which controls were actually created from the axml file before you attempt to manipulate them in the code behind.

Android Query lets you side-step all the checks by conditionally chaining methods. Consider this snippet:

aq.id(R.id.address).text(name).background(R.color.red).textColor(R.color.black).enabled(true).visible().clicked(this, "addressClicked");

If the control address doesn’t exist, all of the setters and event handlers that follow simply become no-ops. While this can make debugging somewhat more difficult, it can dramatically reduce the number of lines needed in your onCreate method.

AQuery also makes invoking asynchronous HTTP requests very easy. It includes support for simple and multi-part POST operations and can accept data in binary, JSON, HTML, and XML formats. Separate support is included for images, where a single line can be used to download an image, cache it, and load the image into control.

Click here to help out:

7434e46bbf78506fa8f91518058cb26ed47597b8

68747470733a2f2f706c65646769652e636f6d2f63616d706169676e732f32323636332e706e673f736b696e5f6e616d653d6368726f6d65

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值