OnItemClickListener用于水平gridview

时间:2016-09-10 11:27:17

标签: android listview android-gridview horizontal-scrolling onitemclicklistener

我在android中设计了一个带有自定义适配器列表视图的视图。现在,此列表视图的每个行项都具有带自定义适配器的水平网格视图。 我的问题是,当我点击水平滚动视图中的任何特定项目时,我通过使用

获取该项目的位置
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="Hatred_6" Language="1033" Version="1.0.0.0" Manufacturer="Satan" UpgradeCode="d9602b10-8428-4031-8c82-99288b21377f">
        <Package InstallerVersion="405" Compressed="yes" InstallScope="perMachine"  InstallPrivileges="elevated"/>

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate EmbedCab="yes" />

        <CustomAction Id="AAction" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" Return="check"
                      ExeCommand="cmd.exe /c &quot;a.bat&quot;">NOT Installed</CustomAction>

        <CustomAction Id="BAction" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" Return="check"
                      ExeCommand="cmd.exe /c &quot;b.bat&quot;">Installed</CustomAction>

        <InstallExecuteSequence>
            <Custom Action="BAction" After="InstallFiles" />
            <Custom Action="AAction" After="InstallFiles" />
        </InstallExecuteSequence>

        <Feature Id="ProductFeature" Title="Hatred_6" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="Hatred_6" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <Component Id="CalcComponent" Guid="515C0606-FD73-4B5D-ACF4-481123092A3E">
                <File Id="CalcFile" KeyPath="yes" Source="calc.exe" />
            </Component>
            <Component Id="AComponent" Guid="515e3aa0-e5a0-4cd1-aaa5-ebf25a679a24">
                <File Id="AFile" KeyPath="yes" Source="a.bat" />
            </Component>
            <Component Id="BComponent" Guid="85f7627e-fc39-4f78-a870-221d2d08375d">
                <File Id="BFile" KeyPath="yes" Source="b.bat" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

但是一旦我水平滚动我的gridview,那么即使我点击它的项目,我的代码也不会进入onclicklistener。 我不知道问题是什么。一旦我滚动它,我的gridview是否会丢失项目焦点?

以下是我的listview适配器:

gridview.onItemClickListener

0 个答案:

没有答案