Hey all I've created Google's exmaple of a tab layout HelloTabWidget.
I know how to create my own icon to use instead of their grey and
white microphone, but I can't figure out how to make my custom icon
fill the entire tab. When the tab is selected it's a light grey with
my pic in the middle and when not selected its a dark grey with my pic
in the middle. I prefer to have my own pic fill the entire tab, and
for more knowledgeable; my own choice in color to fill the tab.
Someone on a different site tried helping me, but I haven't gotten a
response back, they said to use this, quote:"
ImageView imgView = new ImageView(this);
// Use imgView.setImageDrawable(Drawable drawable) or
// imgView.setImageBitmap(Bitmap bitmap) to load
// the image you want into imgView
spec =
tabHost.newTabSpec("artists").setIndicator(imgView).setContent(intent);
I'm not sure if it's what you want but you can (in theory) use any
View class as the Indicator if ImageView doesn't work for you.
EDIT:
I tried...
BitmapDrawable bmd = new BitmapDrawable();
bmd = (BitmapDrawable)
res.getDrawable(R.drawable.ic_tab_artists_grey);
iv.setImageDrawable(bmd);
"-end message.
I'm having trouble trying to use their method, I've tried putting:
BitmapDrawable bmd = new BitmapDrawable(); at the top of my code, and
for the tab:
intent = new Intent().setClass(this, ArtistsActivity.class);
spec = tabHost.newTabSpec ("artists").bmd = (BitmapDrawable)
res.getDrawable(R.drawable.ic_tab_artists_grey);
iv.setImageDrawable(bmd);
.setContent(intent);
tabHost.addTab(spec);
but I keep getting a lot of errors.
--
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