0

我正在尝试向我的 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>

在此先感谢您的帮助。

瑞安

4

1 回答 1

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)">
.... 
于 2012-10-13T13:24:58.167 回答