如題
我的listview會變成這樣
http://imgur.com/a/Mkn2g
從來沒遇到過這種問題....
下面是我左邊listview的adapter
class AreaSelectAdapter extends BaseAdapter {
@Override
public int getCount() {
return TempData.areaData.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
LinearLayout baseLayout = null;
if (convertView == null) {
baseLayout = (LinearLayout) LinearLayout.inflate(mContext, R.layout.item_area, null);
} else {
baseLayout = (LinearLayout) convertView;
}
TextView area = (TextView) baseLayout.findViewById(R.id.list_item);
if (TempData.areaData.size() != 0) {
area.setText(TempData.areaData.get(position).getArea());
}
//將選中的選項反白
if (position == mAreaPosition) {
area.setTextColor(getResources().getColor(R.color.white));
} else {
area.setTextColor(getResources().getColor(R.color.colorBFBFBF));
}
}
先謝謝大家了