问题描述
我试图禁用对象的高亮显示在GridView中的Android 2.2。
I'm trying to disable the highlighting of objects in a GridView in Android 2.2.
我发现这对方的回答说我应该设置选择为透明ColorDrawable(安卓listSelector =@机器人:彩色/透明
),但在我的GridView的意见,当我选择他们仍然暗淡
I found this other answer saying that I should set the selector to a transparent ColorDrawable (android:listSelector="@android:color/transparent"
), but the views in my GridView are still dimmed when I select them.
我只是用GridView控件显示在网格静态对象。没有这些对象将被选中。它会更好只使用一个基本观点和手动绘制我的图片?
I'm just using the GridView to display static objects in a grid. None of these objects will be selected. Would it be better to just use a basic view and draw my images manually?
推荐答案
好了,它看起来像我找到了答案。
Ok, it looks like I found the answer.
在你的适配器为GridView的定义,你将不得不重写以下方法:
In the definition of your Adapter for the GridView, you will have to override the following methods:
@Override
public boolean areAllItemsEnabled()
{
return false;
}
@Override
public boolean isEnabled(int position)
{
return false;
}
这将导致所有的项目中网格是不可选的,但它会摆脱完全的亮点。
This will cause all of the items in your grid to be non-selectable, but it will get rid of the highlight completely.
这篇关于禁用的Android的GridView突出完全(禁用选择)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!