[android-developers] Spinner Styling - Am I Nuts??

2012-07-26 Thread Evan Ruff
Hey guys!

I have a spinner backed up by an ArrayAdapter in my layout. I'd like to 
change the look of the spinner button to match the buttons that are next to 
it.

Here is my Spinner xml:
Spinner
android:id=@+id/location_type_spinner
style=@android:style/Widget.Button
android:layout_width=0dp
android:layout_height=fill_parent
android:layout_weight=.33
android:background=@drawable/control_bar_background
android:gravity=center
android:textColor=#FF00
android:textSize=12dp /

While the bounds of the button (it fills the width/height/weight correctly) 
and the background work, the text is larger and the gravity is not centered.

I'm going nuts trying to fix this! What am I missing? Is there a different 
style I need to use or something like that?

Thanks!

E

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

Re: [android-developers] Spinner Styling - Am I Nuts??

2012-07-26 Thread Kostya Vasilyev
The contents of a spinner is provided by its adapter. Check the layout used
by your adapter's getView().

-- K

2012/7/26 Evan Ruff evan.r...@gmail.com

 Hey guys!

 I have a spinner backed up by an ArrayAdapter in my layout. I'd like to
 change the look of the spinner button to match the buttons that are next to
 it.

 Here is my Spinner xml:
 Spinner
 android:id=@+id/location_type_spinner
 style=@android:style/Widget.Button
 android:layout_width=0dp
 android:layout_height=fill_parent
 android:layout_weight=.33
 android:background=@drawable/control_bar_background
 android:gravity=center
 android:textColor=#FF00
 android:textSize=12dp /

 While the bounds of the button (it fills the width/height/weight
 correctly) and the background work, the text is larger and the gravity is
 not centered.

 I'm going nuts trying to fix this! What am I missing? Is there a different
 style I need to use or something like that?

 Thanks!

 E

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

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

Re: [android-developers] Spinner Styling - Am I Nuts??

2012-07-26 Thread Evan Ruff
Kostya,

Thanks for the response. Just to clarify, the getView in the adapter sets 
the BUTTON? I thought that set the view for the actual menu of items?

Thanks,

E

On Thursday, July 26, 2012 8:38:36 AM UTC-4, Kostya Vasilyev wrote:

 The contents of a spinner is provided by its adapter. Check the layout 
 used by your adapter's getView().

 -- K

 2012/7/26 Evan Ruff evan.r...@gmail.com

 Hey guys!

 I have a spinner backed up by an ArrayAdapter in my layout. I'd like to 
 change the look of the spinner button to match the buttons that are next to 
 it.

 Here is my Spinner xml:
 Spinner
 android:id=@+id/location_type_spinner
 style=@android:style/Widget.Button
 android:layout_width=0dp
 android:layout_height=fill_parent
 android:layout_weight=.33
 android:background=@drawable/control_bar_background
 android:gravity=center
 android:textColor=#FF00
 android:textSize=12dp /

 While the bounds of the button (it fills the width/height/weight 
 correctly) and the background work, the text is larger and the gravity is 
 not centered.

 I'm going nuts trying to fix this! What am I missing? Is there a 
 different style I need to use or something like that?

 Thanks!

 E

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




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

Re: [android-developers] Spinner Styling - Am I Nuts??

2012-07-26 Thread Kostya Vasilyev
The button? There is no button.

If you're on Android 2.*, the little arrow on the right side (which is used
to show the item list) is part of the spinner's background... except I see
you've specified your own.

The text you see inside the spinner is part of the view provided by the
spinner's adapter. The centering, and text size, or its color, if any,
would need to be provided by the adapter's getView().

-- K

2012/7/26 Evan Ruff evan.r...@gmail.com

 Kostya,

 Thanks for the response. Just to clarify, the getView in the adapter sets
 the BUTTON? I thought that set the view for the actual menu of items?

 Thanks,

 E


 On Thursday, July 26, 2012 8:38:36 AM UTC-4, Kostya Vasilyev wrote:

 The contents of a spinner is provided by its adapter. Check the layout
 used by your adapter's getView().

 -- K

 2012/7/26 Evan Ruff evan.r...@gmail.com

 Hey guys!

 I have a spinner backed up by an ArrayAdapter in my layout. I'd like to
 change the look of the spinner button to match the buttons that are next to
 it.

 Here is my Spinner xml:
 Spinner
 android:id=@+id/location_**type_spinner
 style=@android:style/Widget.**Button
 android:layout_width=0dp
 android:layout_height=fill_**parent
 android:layout_weight=.33
 android:background=@drawable/**control_bar_background
 android:gravity=center
 android:textColor=#FF00
 android:textSize=12dp /

 While the bounds of the button (it fills the width/height/weight
 correctly) and the background work, the text is larger and the gravity is
 not centered.

 I'm going nuts trying to fix this! What am I missing? Is there a
 different style I need to use or something like that?

 Thanks!

 E

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en


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


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

Re: [android-developers] Spinner Styling - Am I Nuts??

2012-07-26 Thread Mark Murphy
On Thu, Jul 26, 2012 at 8:44 AM, Evan Ruff evan.r...@gmail.com wrote:
 Thanks for the response. Just to clarify, the getView in the adapter sets
 the BUTTON? I thought that set the view for the actual menu of items?

The SpinnerAdapter supplies both the View for the Spinner in the
closed state and the Views for the rows in the pop-up list that
appears when the Spinner is in the open state. That is why you need to
supply two layout resources.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.8 Available!

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


Re: [android-developers] Spinner Styling - Am I Nuts??

2012-07-26 Thread Kostya Vasilyev
2012/7/26 Mark Murphy mmur...@commonsware.com

 On Thu, Jul 26, 2012 at 8:44 AM, Evan Ruff evan.r...@gmail.com wrote:
  Thanks for the response. Just to clarify, the getView in the adapter sets
  the BUTTON? I thought that set the view for the actual menu of items?

 The SpinnerAdapter supplies both the View for the Spinner in the
 closed state and the Views for the rows in the pop-up list that
 appears when the Spinner is in the open state. That is why you need to
 supply two layout resources.


And to further clarify - it's getView() and getDropDownView() respectively.



 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 _The Busy Coder's Guide to Android Development_ Version 3.8 Available!

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


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

Re: [android-developers] Spinner Styling - Am I Nuts??

2012-07-26 Thread Evan Ruff
AND BOOM. That's where I was getting all turned around.

Thanks Mark and Kostya! 

E

On Thursday, July 26, 2012 8:56:06 AM UTC-4, Kostya Vasilyev wrote:

 2012/7/26 Mark Murphy mmur...@commonsware.com

 On Thu, Jul 26, 2012 at 8:44 AM, Evan Ruff evan.r...@gmail.com wrote:
  Thanks for the response. Just to clarify, the getView in the adapter 
 sets
  the BUTTON? I thought that set the view for the actual menu of items?

 The SpinnerAdapter supplies both the View for the Spinner in the
 closed state and the Views for the rows in the pop-up list that
 appears when the Spinner is in the open state. That is why you need to
 supply two layout resources.


 And to further clarify - it's getView() and getDropDownView() respectively.
  


 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 _The Busy Coder's Guide to Android Development_ Version 3.8 Available!

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




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