小编Pra*_*rma的帖子

如何在 Visual Basic 中获取字符串特定位置的字符?

我想在 Visual Basic 中的特定位置获得一个可用的字符,例如字符串是“APPLE”。

我想获取字符串中的第三个字符,即“P”。

vb.net basic visual-studio-2012

1
推荐指数
1
解决办法
3万
查看次数

如果Android中的listview中的项目超过10,那么listview中每行的5种不同颜色怎么可能?

如下所示创建一个数组作为列表项的no我假设你有五个项目:

int[] color_arr={Color.BLUE,Color.CYAN,Color.YELLOW,Color.GREEN,Color.RED};
Run Code Online (Sandbox Code Playgroud)

并在getView()自定义适配器的方法中使用它如下: -

public View getView(int position, View convertView, ViewGroup parent)
     {

     LayoutInflater inflater = getLayoutInflater();
     View row=convertView;

     row = inflater.inflate(R.layout.listview_custome, parent, false);
     row.setBackgroundColor(color_arr[position]);// this set background color

     TextView textview = (TextView) row.findViewById(R.id.tv_list);
     ImageView imageview = (ImageView) row.findViewById(R.id.iv_list);

     textview.setText(data_text[position]);
     imageview.setImageResource(data_image[position]);

     return (row);

    }
Run Code Online (Sandbox Code Playgroud)

我的问题是,如果列表项中有超过5个项目,listview中每行可能有5种不同的颜色吗?

android listview android-listview

-3
推荐指数
1
解决办法
97
查看次数