如何制作水平SpinnerList [英] How to make Horizontal SpinnerList

查看:96
本文介绍了如何制作水平SpinnerList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我在应用程序中使用SpinnerList,默认情况下它具有垂直布局.但是我有一个水平SpinnerList的要求.

我尝试过轮换,但这还不够.

Hello friends,

I am using SpinnerList in my applicaiton and by default it has a vertical layout. But I have a requirement of Horizontal SpinnerList.

I tried rotation but that was not enough.

<s:titleContent>
   <s:SpinnerListContainer direction="ltr"  autoLayout="true">
       <s:SpinnerList id="titleSpinner" textAlign="center" >
           <s:ArrayList>
              <fx:String>First</fx:String>
              <fx:String>Second</fx:String>
              <fx:String>Third</fx:String>
              <fx:String>Fourth</fx:String>
              <fx:String>Fifth</fx:String>
           </s:ArrayList>
       </s:SpinnerList>
   </s:SpinnerListContainer>
 </s:titleContent>



请指导我



Please guide me

推荐答案

你好,我找到了解决方案.没有水平的微调框列表.因此需要进行控制.

Hello I found the solution. There no horizontal Spinner List. Therefore need to make a control.

<s:Scroller id="scrllr"

                    focusEnabled="false"

                    hasFocusableChildren="true"

                    width="100%">
            <s:HGroup id="hg" gap="20"

                      paddingTop="5" paddingRight="5" paddingBottom="5" paddingLeft="5">
                <s:Label text="First" color="White"

                     focusIn="textinput_focusInHandler(event)"/>
                <s:Label text="Second" color="White"

                     focusIn="textinput_focusInHandler(event)" />
                <s:Label text="Third" color="White"

                     focusIn="textinput_focusInHandler(event)" />
                <s:Label text="Fourth" color="White"

                     focusIn="textinput_focusInHandler(event)" />
                <s:Label text="Fifth" color="White"

                     focusIn="textinput_focusInHandler(event)" />
                <s:Label text="Sixth" color="White"

                     focusIn="textinput_focusInHandler(event)" />
            </s:HGroup>
        </s:Scroller>







protected function textinput_focusInHandler(evt:FocusEvent):void
            {
                var idx:int = hg.getElementIndex(evt.target as IVisualElement);
                var lay:HorizontalLayout =  hg.layout as HorizontalLayout;
                if(lay.fractionOfElementInView(idx)<1)
                {
                    lay.horizontalScrollPosition +=lay.getScrollPositionDeltaToElement(idx).y;
                }
            }


这篇关于如何制作水平SpinnerList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆