state_activated在pre蜂窝设备 [英] state_activated on pre Honeycomb Devices

查看:145
本文介绍了state_activated在pre蜂窝设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您无法使用下列状态绘制背景的列表视图项目。

You can not use the following state drawable as background for listview items.

<item android:drawable="@drawable/ic_launcher" android:state_activated="true"/>

在pre蜂窝设备,因为这个选择是不支持,并有Android版本不跟踪的启动项目(S)的。

On Pre Honeycomb Devices because this selector is not supported there and the android version does not keep track of the activated item(s).

如何这种行为被效仿? (在一个片段列表上的左,这取决于选择的细节视图,右侧),使用尤其是当fragements这个指标是非常重要的。

How can this behaviour be emulated? Especially when using fragements (list on the left in one fragment and depending on what is selected a detail view on the right) this indicator is very important.

我知道,这个问题被问过这里但接受的答案有链接到博客文章,其中指出在第4步,有没有可能有被激活的指标,而不是只禁止​​使用以prevent错误。这导致了不显示指示这就是我在寻找的事实。

I know that this question was asked before here but the accepted answer there links to a blog article which states in "Step 4" that there is no possibility to have the activated indicator and instead only disables the use to prevent errors. This leads to the fact that no indicator is displayed which is what I'm searching for.

推荐答案

我用一个小窍门解决了这个问题:通过missusing的 state_checked 属性,由于Android版本所存在1,有可能效仿 state_activated 行为。没有必要修改列表适配器或保存状态自己。

I solved the problem using a small trick: By missusing the state_checked property, which exists since Android Version 1, it is possible to emulate the state_activated behaviour. There is no need to modify the List adapter or save the state yourself.

我写了包含必要repoduce所有code一个详细的例子,并将其发布在 GitHub的资源库

I wrote a detailed example containing all code necessary to repoduce and published it on a github repository.

这篇关于state_activated在pre蜂窝设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆