현재 상태 입니다
이런식으로 뿌려주고 있는데 밑의 그림 처럼 각 row에 이미지 버튼을 넣고 싶은데
잘안되네요.. 어떻한 방법이 있을까요??
답글 달아주시면 감사하겠습니다
아! 버튼이 두가지 종류가 있는데요 바꿔서 뿌려줘야합니다
물론 클릭이 되어야 하구요
이렇게 넣을수 있을까요??
밑에는 간략한 소스 입니다
========================화면에 뿌려주는 방식================================
/**
* 화면에 목록을 뿌려준다
*/
private void fillList() {
int getCount=0;
int finalDistance = finalDistance();
try {
mDbHelper.open();
if (rif.isfetchList_CATEGORY(DbAdapter.mDb)) {
cursor = rif.allfetchList(DbAdapter.mDb);
}
getCount=cursor.getCount();
} catch (Exception e) {
e.printStackTrace();
} finally {
mDbHelper.close();
}
startManagingCursor(cursor);
_id = new int[getCount];
TITLE = new String[getCount];
DESCRIPTION = new String[getCount];
PERIOD = new int[getCount];
printArr=new String[getCount];
extraPERIOD = new int[getCount];
for(int i=0 ; i < getCount ; i++){
_id[i]=cursor.getInt(0);
TITLE[i]=cursor.getString(1);
DESCRIPTION[i]=cursor.getString(2);
PERIOD[i]=cursor.getInt(3);
extraPERIOD[i]=finalDistance-TEMPDISTANCE[i]-cursor.getInt(3);
cursor.moveToNext();
}
for(int i=0 ; i<cursor.getCount() ;i++){
if(dbMemory.bool_AllList==false){
if(extraPERIOD[i]>0){//초과만 보여준다
p3 = new SubRepair(TITLE[i], PERIOD[i] ,extraPERIOD[i]);
// m_orders.clear();
m_orders.add(p3);
}
}else if(dbMemory.bool_AllList==true){
if(Math.abs(extraPERIOD[i])>0){//전부보여준다
p3 = new SubRepair(TITLE[i], PERIOD[i] ,extraPERIOD[i]);
m_orders.add(p3);
}
}
}
PersonAdapter m_adapter = new PersonAdapter(this
, R.layout.repair_list, m_orders);
if(dbMemory.bool_AllList==true){
dbMemory.bool_AllList=false;
}
setListAdapter(m_adapter);
}// End of fillList()
========================커스텀 아답터=====================================================
private class PersonAdapter extends ArrayAdapter<SubRepair> {
private ArrayList<SubRepair> items;
public PersonAdapter(Context context
, int textViewResourceId
, ArrayList<SubRepair> items) {
super(context, textViewResourceId, items);
this.items = items;
}
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater
vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.repair_list, null);
}
SubRepair p = items.get(position);
if (p != null) {
TextView tt = (TextView) v.findViewById(R.id.repair_list);
TextView bt = (TextView) v.findViewById(R.id.repair_period);
TextView ep = (TextView) v.findViewById(R.id.extra_period);
if (tt != null){
String getTITLE = p.getTITLE();
tt.setText(getTITLE);
}
if(bt != null){
NumberFormat nf = NumberFormat.getInstance();
String getPERIOD = nf.format(p.getPERIOD());
bt.setText("주기: "+ getPERIOD+" Km / ");
}
if(ep != null){
if(p.getextraPERIOD()>0 ||p.getextraPERIOD()==0){
NumberFormat nf = NumberFormat.getInstance();
String getextraPERIOD = nf.format(p.getextraPERIOD());
ep.setText(getextraPERIOD+" Km 초과");
}else if(p.getextraPERIOD()<0){
NumberFormat nf = NumberFormat.getInstance();
int int_getextraPERIOD=Math.abs(p.getextraPERIOD());
String getextraPERIOD = nf.format(int_getextraPERIOD);
ep.setText(getextraPERIOD+" Km 남음");
}
}
}
return v;
}
}
===================================================
여기 이 SubRepair 클래스에 다가 이미지 버튼을 넣어서 같이 뿌려주는 방법이 있을까요??
class SubRepair {
private String TITLE;
private int PERIOD;
private int extraPERIOD;
public SubRepair(String _TITLE, int _PERIOD ,int _extraPERIOD){
this.TITLE = _TITLE;
this.PERIOD = _PERIOD;
this.extraPERIOD =_extraPERIOD;
}
public String getTITLE() {
return TITLE;
}
public int getPERIOD() {
return PERIOD;
}
public int getextraPERIOD() {
return extraPERIOD;
}
}




View v = convertView;
if (v == null) {
LayoutInflater
vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.repair_list, null);
}