Monday, January 6, 2014

[android-developers] Stuck with Own Adapter

public class InvoiceAdapter extends ArrayAdapter<InvoiceHeader> {

@Override public View getDropDownView(int position, View convertView, ViewGroup parent) {
TextView label = new TextView(context);
label.setWidth(700);
label.setMinimumWidth(700);
label.setTextColor(Color.BLACK);
label.setTextSize(20.0f);
label.setTypeface(font);
label.setText(String.format("%-30s%-10s%12s%12s",values[position].getDate(), values[position].getInvoice(), values[position].getAmount(), values[position].getPaid()));
label.setHeight(60);
label.setPadding(10, 10, 10, 10);
return label;
}
}

It would appear that the setWidth  setMinimumWidth  are completely ignored  as the spinner's drop down is always the same width
Even

InvoiceHeader[] invoices = DB.getInvoiceHeadlinesByClient( client ).toArray(new InvoiceHeader[0]);
InvoiceAdapter adapter = new InvoiceAdapter(HomeActivity.this, R.layout.spinner, invoices);
adapter.setDropDownViewResource(R.layout.spinner);
currentInvoice.setDropDownWidth(700);

Even the SetDropDownWidth is ignored

Using a classed ArrayAdapter   ArrayAdapter<InvoiceHeader>  What is the right way to set the Drop Down width ?

Thanks in advance

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate