Spinner:无法解析构造函数

时间:2017-03-07 10:59:16

标签: android

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output omit-xml-declaration="yes" indent="yes"/>


<xsl:template match="//Page">
<html>
<body>
 <xsl:apply-templates select="Sections" />
</body>
</html>
</xsl:template>

<xsl:template match="Sections">
<table>
   <xsl:for-each-group select="Section" group-by="@vorder">
            <xsl:sort select="@vorder"/>
            <tr>
                <xsl:for-each select="current-group()">
                    <xsl:sort select="@horder"/>
                    <xsl:apply-templates select="current()" />
                </xsl:for-each>  
            </tr>
        </xsl:for-each-group>
</table>
</xsl:template>

<xsl:template match="Section">
<td>
   <xsl:attribute name="id" select="@id" />
      <xsl:attribute name="horder" select="@horder" />
   <xsl:apply-templates select="Sections" />
</td>
</xsl:template>

</xsl:stylesheet>

1 个答案:

答案 0 :(得分:3)

您可能错过了上下文。

如果您在片段中使用它(Say AFragment.java),请尝试;

ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, new String[] {"abc","abc"});

            // Drop down layout style - list view with radio button
            dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

            // attaching data adapter to spinner
            spinner.setAdapter(dataAdapter);

或者,如果您在活动中使用它(说AActivity.java),请尝试;

ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(AActivity.this, android.R.layout.simple_spinner_item, new String[] {"abc","abc"});

            // Drop down layout style - list view with radio button
            dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

            // attaching data adapter to spinner
            spinner.setAdapter(dataAdapter);