Spinner outside of ActionBar

瀏覽次數:2,864 次
跳到第一則未讀訊息

Dandre Allison

未讀,
2012年4月9日 晚上7:02:582012/4/9
收件者:actionba...@googlegroups.com
I like the way the ICS spinner works, much more than the old spinner, and it looks like ABS has the ICS spinner compat. Is there a way to use that spinner (or spinner look) outside of the ActionBar without duplicating a similar thing to what was done to get it in the ActionBar?

Jake Wharton

未讀,
2012年4月9日 晚上7:54:322012/4/9
收件者:actionba...@googlegroups.com
You can use it. But it's in an internal package for a reason :) I make no guarantees about its future availability or the stability of its API.

---
Jake Wharton
http://about.me/jakewharton

Jake Wharton

未讀,
2012年4月9日 晚上7:55:042012/4/9
收件者:actionba...@googlegroups.com
I actually was going to do another sweet through and strip out every functionality that wasn't being used to save some bytes... so be extra careful.

Dandre Allison

未讀,
2012年4月9日 晚上8:32:432012/4/9
收件者:actionba...@googlegroups.com
So on my first attempt to use it in XML it raised the context attributeset constructor not found. So I extended IcsSpinner and wrote constructor that called super wih defTheme 0. That got me a view that was essentially a textview for the first spinner item. Not triangle icon or interactivity.

Also, thanks for the warning, I hope that the bare click it and select an item won't be stripped out, that's all the functionality I require.

PS if my variable names are slightly off I apologize, but I can't reference the code right now.

Jake Wharton

未讀,
2012年4月9日 晚上8:52:162012/4/9
收件者:actionba...@googlegroups.com
The action bar constructs it purely programmatically. You should pass R.style.Widget_Sherlock_Spinner_DropDown_ActionBar as a default style.

Dandre Allison

未讀,
2012年4月10日 下午3:01:302012/4/10
收件者:actionba...@googlegroups.com
Ok, so I performed two experiments, 1) copy how ActionBarView creates the IcsSpinner, 2) make a normal Spinner look like the IcsSpinner. For the IcsSpinner my problem is that it's always just the bare text of the first item in the adapter, no background drawable, no interactivity. For the normal Spinner it doesn't complain when I set the dropDownSelector, popupBackground and backgroundDrawable to be the ones from the IcsSpinner style, however if I try to use R.layout.sherlock_spinner_item for the adapter view or R.layout.sherlock_spinner_dropdown_item for the dropDownViewResource I get error2. I have the code snippet and the potential issues with the IcsSpinner I think are related to what I get in error.txt.
code_snippet.java
error2.text
errror.txt

Jake Wharton

未讀,
2012年4月12日 晚上11:29:052012/4/12
收件者:actionba...@googlegroups.com
The first error text doesn't affect anything. You're obviously just running on a pre-ICS device so it's converting some bytecode to no-ops since certain methods are not available. Their never called anyways so there is no effect.

I don't see any problems with the example. The second error is likely due to you not using a sherlock theme. A lot of the layouts and styles refer to various attributes from the sherlock themes so if you aren't using one they will be null which translates to it thinking you didn't define an attribute. In this case, it's probably the actionBarSize attribute or the dropDownListItemHeight attribute from the list item view.

Dandre Allison

未讀,
2012年4月13日 下午4:39:012012/4/13
收件者:actionba...@googlegroups.com
Thanks for the comments, I understand my question doesn't really involve the intended use of the ABS library. It's good to know that the error text is expected. I'm making the IcsSpinner inside of an activity that is using the Sherlock Dialog theme to simulate the ICS dialog display, if that changes anything. My example is almost extracted verbatim from the ActionBarView, so I'm glad you don't see any problems with it, though it still doesn't make the Spinner for me. For now I will stick with the Spinner with IcsSpinner drawables. 

Jake Wharton

未讀,
2012年4月13日 下午4:41:272012/4/13
收件者:actionba...@googlegroups.com
I would try adding the following to your theme:

        <item name="spinnerDropDownItemStyle">@style/Widget.Sherlock.DropDownItem.Spinner</item>
        <item name="spinnerItemStyle">@style/Widget.Sherlock.TextView.SpinnerItem</item>

        <!-- Internal --><item name="dropdownListPreferredItemHeight">48dip</item>
        <item name="dropDownListViewStyle">@style/Widget.Sherlock.ListView.DropDown</item>
        
        <item name="popupMenuStyle">@style/Widget.Sherlock.PopupMenu</item>
        <!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.ListPopupWindow</item>

One or more of those is bound to be what's missing. (I'm betting on dropdownListPreferredItemHeight)

Dandre Allison

未讀,
2012年4月16日 下午6:57:582012/4/16
收件者:actionba...@googlegroups.com
Looks like I get this with the changed theme:

04-02 11:39:44.941: ERROR/AndroidRuntime(2047): FATAL EXCEPTION: main
        android.view.InflateException: Binary XML file line #20: Error inflating class <unknown>
        at android.view.LayoutInflater.createView(LayoutInflater.java:518)
        at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
        at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332)
        at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
        at com.actionbarsherlock.internal.widget.IcsAbsSpinner.onMeasure(IcsAbsSpinner.java:200)
        at com.actionbarsherlock.internal.widget.IcsSpinner.onMeasure(IcsSpinner.java:219)
        at android.view.View.measure(View.java:8313)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
        at com.actionbarsherlock.internal.widget.IcsLinearLayout.measureChildWithMargins(IcsLinearLayout.java:143)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
        at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:701)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:311)
        at android.view.View.measure(View.java:8313)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
        at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:701)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:311)
        at android.view.View.measure(View.java:8313)
        at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
        at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
        at android.view.View.measure(View.java:8313)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
        at android.view.View.measure(View.java:8313)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
        at android.view.View.measure(View.java:8313)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
        at com.actionbarsherlock.internal.widget.FakeDialogPhoneWindow.onMeasure(FakeDialogPhoneWindow.java:33)
        at android.view.View.measure(View.java:8313)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
        at android.view.View.measure(View.java:8313)
        at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
        at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:123)
        at android.app.ActivityThread.main(ActivityThread.java:3683)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:507)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
        at dalvik.system.NativeStart.main(Native Method)
        Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.constructNative(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
        at android.view.LayoutInflater.createView(LayoutInflater.java:505)
        ... 48 more
        Caused by: android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): TypedValue{t=0x2/d=0x7f010037 a=2}
        at android.content.res.Resources.loadColorStateList(Resources.java:1804)
        at android.content.res.TypedArray.getColorStateList(TypedArray.java:342)
        at android.widget.TextView.<init>(TextView.java:399)
        at android.widget.TextView.<init>(TextView

Rafael Muñoz

未讀,
2012年4月19日 晚上8:12:412012/4/19
收件者:actionba...@googlegroups.com
Any news on this? I'm also very interested on using the ICS spinner outside ActionBar.

Dandre Allison

未讀,
2012年4月20日 中午12:04:362012/4/20
收件者:actionba...@googlegroups.com
As it stands, I get errors when trying what Jake suggests. I get a TextView of the first item without his suggestions. I get the ICS Spinner look by using the drawables from ABS on a regular Spinner, but not fully. I believe I've shared the code I have earlier.  

Will

未讀,
2012年4月20日 下午1:46:132012/4/20
收件者:actionba...@googlegroups.com
I have got the spinner working by doing the following:

1) My style extends from @style/Theme.Sherlock
2) Added IcsSpinner to my layout
<com.actionbarsherlock.internal.widget.IcsSpinner
                android:id="@+id/spinnerMediaType"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

3) row_layout_ics_spinner.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:paddingLeft="5dp"
    android:paddingTop="3dp"
    android:paddingBottom="3dp"
    android:paddingRight="2dp"
    android:singleLine="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee" />

4) Get a reference to the spinner and set the content
        mSpinnerMediaType = (IcsSpinner)findViewById(R.id.spinnerMediaType);
        mSpinnerMediaType.setAdapter(ArrayAdapter.createFromResource(
                getApplicationContext(), R.array.mediaTypes,
                R.layout.row_layout_ics_spinner));

Rafael Muñoz

未讀,
2012年4月21日 下午1:45:552012/4/21
收件者:actionba...@googlegroups.com
After several tries I am stuck in the same place as Dandre. The best thing I got is a normal Spinner with a ICS look using drawable as him.

@Will, I tried your method but I just got a nasty exception:


04-21 17:36:55.389: I/dalvikvm(1550): Could not find method com.actionbarsherlock.internal.widget.IcsAbsSpinner.resolveSizeAndState, referenced from method com.actionbarsherlock.internal.widget.IcsAbsSpinner.onMeasure
04-21 17:36:55.389: W/dalvikvm(1550): VFY: unable to resolve static method 5040: Lcom/actionbarsherlock/internal/widget/IcsAbsSpinner;.resolveSizeAndState (III)I
04-21 17:36:55.389: D/dalvikvm(1550): VFY: replacing opcode 0x71 at 0x0141
04-21 17:36:55.389: D/dalvikvm(1550): VFY: dead code 0x0144-014b in Lcom/actionbarsherlock/internal/widget/IcsAbsSpinner;.onMeasure (II)V
04-21 17:36:55.389: I/dalvikvm(1550): Could not find method android.view.ViewGroup.onInitializeAccessibilityEvent, referenced from method com.actionbarsherlock.internal.widget.IcsAdapterView.onInitializeAccessibilityEvent
04-21 17:36:55.389: W/dalvikvm(1550): VFY: unable to resolve virtual method 2486: Landroid/view/ViewGroup;.onInitializeAccessibilityEvent (Landroid/view/accessibility/AccessibilityEvent;)V
04-21 17:36:55.389: D/dalvikvm(1550): VFY: replacing opcode 0x6f at 0x0000
04-21 17:36:55.389: D/dalvikvm(1550): VFY: dead code 0x0003-0033 in Lcom/actionbarsherlock/internal/widget/IcsAdapterView;.onInitializeAccessibilityEvent (Landroid/view/accessibility/AccessibilityEvent;)V
04-21 17:36:55.389: W/dalvikvm(1550): VFY: unable to find class referenced in signature (Landroid/view/accessibility/AccessibilityNodeInfo;)
04-21 17:36:55.389: I/dalvikvm(1550): Could not find method android.view.ViewGroup.onInitializeAccessibilityNodeInfo, referenced from method com.actionbarsherlock.internal.widget.IcsAdapterView.onInitializeAccessibilityNodeInfo
04-21 17:36:55.389: W/dalvikvm(1550): VFY: unable to resolve virtual method 2487: Landroid/view/ViewGroup;.onInitializeAccessibilityNodeInfo (Landroid/view/accessibility/AccessibilityNodeInfo;)V
04-21 17:36:55.389: D/dalvikvm(1550): VFY: replacing opcode 0x6f at 0x0000
04-21 17:36:55.389: D/dalvikvm(1550): VFY: dead code 0x0003-0017 in Lcom/actionbarsherlock/internal/widget/IcsAdapterView;.onInitializeAccessibilityNodeInfo (Landroid/view/accessibility/AccessibilityNodeInfo;)V
04-21 17:36:55.389: I/dalvikvm(1550): Could not find method android.view.ViewGroup.onRequestSendAccessibilityEvent, referenced from method com.actionbarsherlock.internal.widget.IcsAdapterView.onRequestSendAccessibilityEvent
04-21 17:36:55.389: W/dalvikvm(1550): VFY: unable to resolve virtual method 2488: Landroid/view/ViewGroup;.onRequestSendAccessibilityEvent (Landroid/view/View;Landroid/view/accessibility/AccessibilityEvent;)Z
04-21 17:36:55.389: D/dalvikvm(1550): VFY: replacing opcode 0x6f at 0x0000
04-21 17:36:55.389: D/dalvikvm(1550): VFY: dead code 0x0003-0016 in Lcom/actionbarsherlock/internal/widget/IcsAdapterView;.onRequestSendAccessibilityEvent (Landroid/view/View;Landroid/view/accessibility/AccessibilityEvent;)Z
04-21 17:36:55.389: D/AndroidRuntime(1550): Shutting down VM
04-21 17:36:55.389: W/dalvikvm(1550): threadid=1: thread exiting with uncaught exception (group=0xb67744f0)
04-21 17:36:55.389: E/AndroidRuntime(1550): FATAL EXCEPTION: main
04-21 17:36:55.389: E/AndroidRuntime(1550): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.criticalpath.uitest/net.criticalpath.uitest.UITestActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.actionbarsherlock.internal.widget.IcsSpinner
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.os.Looper.loop(Looper.java:130)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.app.ActivityThread.main(ActivityThread.java:3683)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at java.lang.reflect.Method.invokeNative(Native Method)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at java.lang.reflect.Method.invoke(Method.java:507)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at dalvik.system.NativeStart.main(Native Method)
04-21 17:36:55.389: E/AndroidRuntime(1550): Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.actionbarsherlock.internal.widget.IcsSpinner
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.view.LayoutInflater.createView(LayoutInflater.java:508)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.app.Activity.setContentView(Activity.java:1657)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at net.criticalpath.uitest.UITestActivity.onCreate(UITestActivity.java:17)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-21 17:36:55.389: E/AndroidRuntime(1550):     ... 11 more
04-21 17:36:55.389: E/AndroidRuntime(1550): Caused by: java.lang.NoSuchMethodException: IcsSpinner(Context,AttributeSet)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at java.lang.Class.getMatchingConstructor(Class.java:643)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at java.lang.Class.getConstructor(Class.java:472)
04-21 17:36:55.389: E/AndroidRuntime(1550):     at android.view.LayoutInflater.createView(LayoutInflater.java:480)
04-21 17:36:55.389: E/AndroidRuntime(1550):     ... 21 more

I tried to add a IcsSpinner(Context,AttributeSet) constructor with default defStyle=0 ... that worked but I just a got a TextView of the first item.

Rafael Muñoz

未讀,
2012年4月21日 下午1:47:202012/4/21
收件者:actionba...@googlegroups.com
I was trying my tests in a 2.3.3 emulator ... maybe it's related to the Android version?

Will

未讀,
2012年4月21日 下午3:26:582012/4/21
收件者:actionba...@googlegroups.com
I'll double check I didn't do anything else, but I'm pretty sure that is all I did.

I've tried in on my 2.3.7 phone, a 2.3.3, 3.1, 3.2 and 4.0.3 emulator, plus I haven't had any crash reports or complaints about the how it looks from my users (I added it to an update I released 4 days ago)

Will

未讀,
2012年4月21日 下午3:30:202012/4/21
收件者:actionba...@googlegroups.com
Are you on ABS 4.0.2, specifically https://github.com/JakeWharton/ActionBarSherlock/commit/2fddc996846c7a7b1dd284d3cfc95b47c1a7f2f4 adds the correct constructor to allow inflating from xml.  https://github.com/JakeWharton/ActionBarSherlock/commit/86b1759d08cbfd3eba349cdcdada036240bf76f9 may also be important, I would just update to 4.0.2 if you aren't there already.


On Saturday, 21 April 2012 18:47:20 UTC+1, Rafael Muñoz wrote:

Rafael Muñoz

未讀,
2012年4月21日 下午6:43:542012/4/21
收件者:actionba...@googlegroups.com
That was it! I was in 4.0.1 ... I upgrade to 4.0.2 and it works!

Thanks a lot. It looks wonderful


On Saturday, April 21, 2012 9:30:20 PM UTC+2, Will wrote:
Are you on ABS 4.0.2, specifically https://github.com/JakeWharton/ActionBarSherlock/commit/2fddc996846c7a7b1dd284d3cfc95b47c1a7f2f4 adds the correct constructor to allow inflating from xml.  https://github.com/JakeWharton/ActionBarSherlock/commit/86b1759d08cbfd3eba349cdcdada036240bf76f9 may also be important, I would just update to 4.0.2 if you aren't there already.

On Saturday, 21 April 2012 18:47:20 UTC+1, Rafael Muñoz wrote:
I was trying my tests in a 2.3.3 emulator ... maybe it's related to the Androirad version?

Dandre Allison

未讀,
2012年4月24日 下午5:28:522012/4/24
收件者:actionba...@googlegroups.com
Yeah, what Will does seems to work for me ONLY when I'm using Theme.Sherlock.Light instead of Theme.Sherlock.Light.Dialog (which is what I need). I have to figure out what's different about the dialog theme.


On Monday, April 9, 2012 4:02:58 PM UTC-7, Dandre Allison wrote:

Jake Wharton

未讀,
2012年4月24日 下午5:42:392012/4/24
收件者:actionba...@googlegroups.com
It lacks attributes for the action bar-specific views. Probably (and most notably) actionDropDownStyle. There may be others.

Dandre Allison

未讀,
2012年4月24日 下午6:03:362012/4/24
收件者:actionba...@googlegroups.com
That would make sense, sense there is no action bar in a dialog. My current workaround is to inherit from the regular theme, and include the dialog themes. Maybe I can figure it out. Thanks for adding the constructor for IcsSpinner for us crazy people.

Dandre Allison

未讀,
2012年4月24日 下午6:10:452012/4/24
收件者:actionba...@googlegroups.com
Yes, I would say actionDropDownStyle is the most notable. Adding it was what I was missing.

Dandre Allison

未讀,
2012年4月24日 晚上7:56:422012/4/24
收件者:actionba...@googlegroups.com
Any chance you know why the spinner's text is a light grey instead of looking like the rest of my text which appears to be black (almost black)?


On Monday, April 9, 2012 4:02:58 PM UTC-7, Dandre Allison wrote:
I like the way the ICS spinner works, much more than the old spinner, and it looks like ABS has the ICS spinner compat. Is there a way to use that spinner (or spinner look) outside of the ActionBar without duplicating a similar thing to what was done to get it in the ActionBar?

On Monday, April 9, 2012 4:02:58 PM UTC-7, Dandre Allison wrote:
I like the way the ICS spinner works, much more than the old spinner, and it looks like ABS has the ICS spinner compat. Is there a way to use that spinner (or spinner look) outside of the ActionBar without duplicating a similar thing to what was done to get it in the ActionBar?

On Monday, April 9, 2012 4:02:58 PM UTC-7, Dandre Allison wrote:
I like the way the ICS spinner works, much more than the old spinner, and it looks like ABS has the ICS spinner compat. Is there a way to use that spinner (or spinner look) outside of the ActionBar without duplicating a similar thing to what was done to get it in the ActionBar?

On Monday, April 9, 2012 4:02:58 PM UTC-7, Dandre Allison wrote:
I like the way the ICS spinner works, much more than the old spinner, and it looks like ABS has the ICS spinner compat. Is there a way to use that spinner (or spinner look) outside of the ActionBar without duplicating a similar thing to what was done to get it in the ActionBar?

On Monday, April 9, 2012 4:02:58 PM UTC-7, Dandre Allison wrote:

Jake Wharton

未讀,
2012年4月24日 晚上7:59:372012/4/24
收件者:actionba...@googlegroups.com
That's entirely dependent on the view you are using the adapter for the selected item. The sherlock_spinner_item probably relies on other theme elements.

David Montemayor

未讀,
2012年4月25日 下午5:25:082012/4/25
收件者:actionba...@googlegroups.com
Hah, I just realized I just asked the same question. Damnit! TL;DR.

David Montemayor

未讀,
2012年4月25日 下午5:28:122012/4/25
收件者:actionba...@googlegroups.com
Dandre, were you able to get it working? I have it working in my project somewhat cleanly, feel free to ask me. Also, I posted the way I use it in SO.

David Montemayor

未讀,
2012年4月25日 下午5:29:432012/4/25
收件者:actionba...@googlegroups.com
Also, getting the spinner to look right was a PITA. I couldn't get it to work without using the  R.layout.sherlock_spinner_dropdown_item layout. :-).

Jake Wharton

未讀,
2012年4月25日 下午5:34:082012/4/25
收件者:actionba...@googlegroups.com
If you use 4.0.2 you there is a new constructor which will allow inflation from XML.

David Montemayor

未讀,
2012年4月25日 下午5:35:102012/4/25
收件者:actionba...@googlegroups.com


Here's how it looks inside my app. My use case might not be standard because I'm using the light theme with a dark action bar.

David Montemayor

未讀,
2012年4月25日 下午5:38:502012/4/25
收件者:actionba...@googlegroups.com
Ah, that would eliminate the need for me to extend it :D woot! Maybe I should keep up with the latest versions. Hehe.


On Wednesday, April 25, 2012 5:34:08 PM UTC-4, Jake Wharton wrote:
If you use 4.0.2 you there is a new constructor which will allow inflation from XML.

---
Jake Wharton
http://about.me/jakewharton

Dandre Allison

未讀,
2012年4月25日 下午6:25:382012/4/25
收件者:actionba...@googlegroups.com
That looks good, right now my text is showing up as light grey and isn't centered in the drop down. Yeah, 4.0.2 makes it easier to use the IcsSpinner with XML.

Stephan

未讀,
2012年7月17日 凌晨12:05:062012/7/17
收件者:actionba...@googlegroups.com
Is there a complete example using the latest 4.0.2?

Stefano IceCubeR

未讀,
2013年4月24日 上午10:55:102013/4/24
收件者:actionba...@googlegroups.com
I'm also using the light theme with a dark action bar, and i'm looking to add spinner, outside abs,
but instead with dark background as it's an 'extension' of the actionbar....

see my previus post: https://groups.google.com/d/msg/actionbarsherlock/ytZ0Ci0THFw/C4pgzguCYd4J
回覆所有人
回覆作者
轉寄
訊息已遭刪除
0 則新訊息