访问gridview中的每个textview并将颜色设置为白色

时间:2013-04-17 19:51:34

标签: java android

很抱歉,如果这是一个奇怪的问题,我真的不明白如何让这个工作。 基本上,我想要一个行为,这样当你点击我的一个gridview项目时,它会突出显示红色,这样可以正常工作,但是我需要它来点击方法一次只有2个突出显示的字母。

在此方法之外是

public void onItemClick(AdapterView<?>parent, View v, int position, long id)
{
    //selection.setText(Words[position]);
}

这是我的方法内部被解雇

public void onItemClick(AdapterView<?> arg0,View arg1, int arg2, long arg3)
{
    Toast.makeText(getApplicationContext(), ""+arg2,Toast.LENGTH_SHORT).show(); 
    ((TextView) arg1).setTextColor(getResources().getColor(android.R.color.holo_red_light));
                ((TextView) arg1).setTextSize(9);
    counter++;
    if(counter == 2)
    {
        //this needs to select everything in the gridview and set to white
    }
}

有没有人有任何想法我会怎么做(如果它甚至可能)

1 个答案:

答案 0 :(得分:1)

对它进行排序。

                if(counter == 3)
                {
                    gridView.setAdapter(adapter);
                    // do the check if its a word or not

                    counter = 0;

            }

就像一个魅力