Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old September 14th, 2009, 05:39 PM   #1 (permalink)
New Member
 
Join Date: Sep 2009
Posts: 1
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default Programmatically set typeface and textsize of Spinner / ComboBox

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);
}
}

mobiforms is offline  
Reply With Quote
Sponsors
Reply

Bookmarks

Tags
android, combobox, dynamic, java, spinner


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically remove widget yenpei Android Applications 15 February 28th, 2011 08:02 PM
Changing Typeface of Android Search UI rsdevgun Android Lounge 1 September 5th, 2010 04:48 AM
TextSize changing in ListView kiranuday43 Application Development 3 June 4th, 2010 05:47 AM
Create combobox without XML IORI999 Application Development 1 December 13th, 2009 02:17 PM
How to read all Email and Gmail programmatically websurf Application Development 0 March 13th, 2009 03:25 AM



All times are GMT -5. The time now is 12:55 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo


SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.