リソースフォルダに200枚の画像があり、名前を付けましname_1.pngたname_2.png。そして、私は、のようないくつかの数を持っているという点で配列を持ってい2, 4 , 6 ,30 , 40 ... and so onます。
listview画像とテキストビューをAndroidにロードし、リソースフォルダの番号に従って画像を表示したいと思います。
このために、activity classとimage adapter classを作成しましたcustom list view。
text view配列データ番号によると、データは表示できますが、画像は表示できません。
誰かが私にこれを行う方法を提案できますか?getview画像を変更するメソッドにコードを書かなければならないと思っています。
これはgetview私が試した方法です
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = mInflater.inflate(mViewResourceId, null);
TextView tv1 = (TextView)convertView.findViewById(R.id.tvtype);
TextView tv2 = (TextView)convertView.findViewById(R.id.tvnumber);
ImageView i1= (ImageView)convertView.findViewById(R.id.ivlfirst);
//int i = Integer.parseInt("normal_"+mStrings.get(position)+".png");
i1.setBackgroundResource("normal_"+mStrings.get(position)+".png");
tv1.setText(mStrings1.get(position));
tv2.setText(mStrings.get(position));
return convertView;
}