--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

--- Begin Message ---
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

--- Begin Message ---
For other items settypeface and settextsize are available, but not for
Spinner.  I would like to have a mechanism that dynamically changes
the Spinner without using a fixed XML definition.  I am trying to re-
program the default android.R.layout.simple_spinner_item and
android.R.layout.simple_spinner_dropdown_item containers.  I have
tried the following code without success.  Where am I going wrong?

class ComboBox extends Spinner {
  private int listid;
  private ArrayList<String> alist = new ArrayList<String>();
  private TextView          ssi;
  private CheckedTextView   ssdi;
  public ComboBox (Context context,int listid) {
    super(context);
    this.listid = listid;
    ArrayAdapter<String> ladapt = new ArrayAdapter<String>(context,
android.R.layout.simple_spinner_item, alist);
    ladapt.setDropDownViewResource
(android.R.layout.simple_spinner_dropdown_item);
    setAdapter(ladapt);
    ssi  = (TextView)findViewById
(android.R.layout.simple_spinner_item);
    ssdi = (CheckedTextView)findViewById
(android.R.layout.simple_spinner_dropdown_item);
  }
  public int getId() {
    return listid;
  }
  public void addItem(String txt) {
    alist.add(txt);
  }
  public void setTypeface(Typeface tf) {
    ssi.setTypeface(tf);
    ssdi.setTypeface(tf);
  }
  public void setTextColor(int colour) {
    ssi.setTextColor(colour);
    ssdi.setTextColor(colour);
  }
  public void setTextSize(int sz) {
    ssi.setTextSize(sz);
    ssdi.setTextSize(sz);
  }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---


--- End Message ---

--- End Message ---

Reply via email to