本文介绍了禁用的Andr​​oid的GridView突出完全(禁用选择)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图禁用对象的高亮显示在GridView中的Andr​​oid 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.

这篇关于禁用的Andr​​oid的GridView突出完全(禁用选择)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:37