如何将搜索栏添加到Android的Flash Builder移动应用程序?

时间:2012-10-13 03:47:20

标签: java flex android-listview flash-builder searchbar

我正在尝试向我的Android应用程序添加搜索/过滤功能。我将提供一个屏幕截图和一个编码副本,以便您可以看到我想要在这里得到的确切内容。我不确定最好的办法是什么。

`<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="iCalculate">



<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<s:layout>  
    <s:VerticalLayout paddingTop="10"/>
</s:layout>
<fx:Script>
    <![CDATA[
        import spark.components.Image;
        import spark.components.ViewMenu;
        import spark.events.IndexChangeEvent;

        protected function calcList_changeHandler(event:IndexChangeEvent):void
        {
            // This method contains the selection assignments for the Calculator Views

            if(calcList.selectedIndex == 0)//A1c Calculator
            {
                navigator.pushView(views.A1CCalculator);
            }
            else if (calcList.selectedIndex ==1)//BMI Calculator
            {
                navigator.pushView(views.BMI_Calculator);
            }
            else if (calcList.selectedIndex ==2)//GPA Calculator
            {
                navigator.pushView(views.GPA_Calculator);
            }
            else if (calcList.selectedIndex ==3)//TIP Calculator
            {
                navigator.pushView(views.TipCalculator);
            }
        }

    ]]>
</fx:Script>

<s:Label color="#1021C7" text="Welcome to iCalculate (4)" textAlign="center"
         verticalAlign="middle" click="navigator.pushView(views.CompanyDetail)"/>
<s:List id="calcList" alternatingItemColors="[#e5e4e4,#ffffff]"
        width="100%"
        height="90%"
        labelField="name"
        change="calcList_changeHandler(event)">
    <s:ArrayCollection> 
        <fx:Object name="A1c Calculator" />
        <fx:Object name="BMI Calculator" />
        <fx:Object name="GPA Calculator" />
        <fx:Object name="Tip Calculator" />

    </s:ArrayCollection>
</s:List>
<s:Label color="#1021C7" fontFamily="_typewriter" fontSize="10"
         text="Powered by WATTS Professionals"/>
</s:View>

提前感谢您的帮助。

瑞安

1 个答案:

答案 0 :(得分:0)

根据您在图片中显示的内容,我不知道您为什么不能在当前布局中添加另一个“行”。从概念上讲是这样的:

<s:Label color="#1021C7" text="Welcome to iCalculate (4)" textAlign="center"
         verticalAlign="middle" click="navigator.pushView(views.CompanyDetail)"/>
    <s:HGroup>
     <s:TextInput id="searchInput"/> 
     <s:Button label="Search"/>
    </s:HGroup>
<s:List id="calcList" alternatingItemColors="[#e5e4e4,#ffffff]"
        width="100%"
        height="90%"
        labelField="name"
        change="calcList_changeHandler(event)">
....