在Android 2.3的NavigationDrawer选择问题 [英] NavigationDrawer selection issue in Android 2.3

查看:194
本文介绍了在Android 2.3的NavigationDrawer选择问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的NavigationDrawer列表项是如何定义的。

This is how my NavigationDrawer list item is defined.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    style="?android:attr/spinnerDropDownItemStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" 
    android:padding="15dp">

    <ImageView
        android:id="@+id/drawer_list_item_icon"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:adjustViewBounds="true" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center_vertical|left"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/drawer_list_item_title"
            style="?android:attr/spinnerDropDownItemStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:textColor="#00FFFF"
            android:singleLine="true" />

        <TextView
            android:id="@+id/drawer_list_item_subtitle"
            style="?android:attr/spinnerDropDownItemStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceSmall" />
    </LinearLayout>

</LinearLayout>

我使用ActionBarSherlock库一起 SherlockNavigationDrawer

I am using ActionBarSherlock library along with SherlockNavigationDrawer.

一切都在我的Andr​​oid 4.3设备可以正常使用。

Everything is working perfectly in my Android 4.3 device.

但在我的2.3.3的设备,我遇到一个奇怪的问题。

But in my 2.3.3 device, I am experiencing a strange issue.

这是最初的NavigationDrawer的外观。

This is how the initial NavigationDrawer looks.

问题场景:我preSS和举行任何的listItem然后将我的手指(同时仍按住)向上或向下走向另一个的listItem

Problem scenario : I press and hold any listItem and then drag my finger (while still holding down) up or down towards another listItem.

这是当发生这种情况。

所有的listItems中得到突出显示在白色,它仍然像像之前,除非其他的listItem单击以正常的方式(即使我关闭并重新打开NavDrawer,还是整个名单仍然以白色高亮显示)。

All the listItems get highlighted in white and it remains like like until and unless another listItem is clicked in the normal way (even if I close and reopen the NavDrawer, still the whole list remains highlighted in white).

这不会是Android 4.3,虽然发生了。

This does not happen in Android 4.3 though.

这种事只有在Android的2.3.3(可能发生在所有的pre-ICS的设备)。

It happens only in Android 2.3.3 (maybe happens on all pre-ICS devices).

时它与兼容库的问题?

这是唯一的额外code我在值-V11夹,因为activatedBackgroundIndicator中的Andr​​oid 2.3将不可用。

This is the only additional code I have in values-v11 folder, because "activatedBackgroundIndicator" is not available in Android 2.3.

<resources>
    <style name="listViewActivatedStyle">
        <item name="android:background">?android:attr/activatedBackgroundIndicator</item>
    </style>
</resources>

Android 2.3的没有得到进入上述code。是,它是给这个问题的原因是什么?或者没有在兼容性库中的错误?

Android 2.3 does not get access to the above code. Is that the reason it is giving this issue ? Or there is a bug in the compatibility library?

任何建议会深深AP preciated。

Any suggestions will be deeply appreciated.

推荐答案

尝试添加

android:cacheColorHint="@null"

到列表

这篇关于在Android 2.3的NavigationDrawer选择问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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