我的drawableLeft正在“随机”消失

时间:2014-03-13 09:28:37

标签: android

这似乎是我正在研究的项目的具体问题。

这个项目见过几个开发人员,并且在许多方面都没有正确编码。我也是Android开发的新手,所以我可能会遗漏一些非常基本的东西。

我们有一个搜索页面,我们可以使用一个搜索字段搜索"posts""users""groups"。结果保存在StickyListHeadersListView中。如果我们触摸每种结果类型的标题,我们会访问一个子页面,显示此类型的更多结果。

我的问题与用户单元格有关。我们有两个按钮,我们可以触摸follow/unfollow此用户,drawableLeft会在我们按下按钮时发生变化。

对于每个单元格,仅显示相应的按钮。这是他们的代码(第二个按钮有另一个id和drawableLeft):

<Button
    android:id="@+id/button_follow"
    style="@style/Button.Small"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="12dp"
    android:drawableLeft="@drawable/button_follow"
    android:ellipsize="end"
    android:focusable="false"
    android:maxLines="1"
    android:paddingLeft="10dip"
    android:paddingRight="10dip"
    android:text="@string/follow" />

drawableLeft代码:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="100" android:exitFadeDuration="100">

    <item android:drawable="@drawable/icon_button_add_on" android:state_pressed="true" />
    <item android:drawable="@drawable/icon_button_add_off" />

</selector>

单元格布局用于其他页面,在那里工作得很好。在搜索页面上,图标在这里,但有时会随机消失。对于列表中的所有用户,按钮应始终显示drawableLeft,并且在出现此问题时不会显示。我在LogCat也没有错误。

当我的单元格没有drawableLeft时,

Here is a screenshot

我在Galaxy S2和S3上测试过它。我不确定它,但是当API的请求完成时似乎发生了很多。我的一位同事告诉我这可能是光标的问题,但我不知道如何检查。

对不起,这个问题还不太清楚,但也许会给某人敲钟声。

感谢您的关注!

修改 添加了截图链接,以更好地解释我的问题。

0 个答案:

没有答案