Android中的dotnetgrid视图功能

Android中的dotnetgrid视图功能,android,android-layout,android-gridview,Android,Android Layout,Android Gridview,如何在android中绑定GridView,就像在dot net中一样。请看下面的代码,它将为每一行提供删除按钮。android中是否有类似的功能 <asp:GridView ID="gvSample" runat="server" Width="100%" AutoGenerateColumns="false" DataKeyNames="ID,Place,MAddress" OnRowCommand="gvSensors_RowComm

如何在android中绑定
GridView
,就像在dot net中一样。请看下面的代码,它将为每一行提供删除按钮。android中是否有类似的功能

<asp:GridView ID="gvSample" runat="server" Width="100%" 
                        AutoGenerateColumns="false" DataKeyNames="ID,Place,MAddress" OnRowCommand="gvSensors_RowCommand">
    <Columns>
        <asp:BoundField DataField="DeviceName" HeaderText="S ID">
        <ItemStyle HorizontalAlign="Center" />
        </asp:BoundField>
       <asp:BoundField DataField="MCountry" HeaderText="COUNTRY">
        <ItemStyle HorizontalAlign="Center" />
        </asp:BoundField>
        <asp:BoundField DataField="MState" HeaderText="STATE">
        <ItemStyle HorizontalAlign="Center" />
        </asp:BoundField>
        <asp:TemplateField HeaderText="Select">
        <ItemTemplate>
            <asp:ImageButton ID="BtnSelect" ImageUrl="~/img/select.png" runat="server" CausesValidation="False"
            CommandArgument='<%#((GridViewRow) Container).RowIndex %>' CommandName="Select" />
        </ItemTemplate>
        <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Delete">
        <ItemTemplate>
            <asp:ImageButton ID="lnkbtnDelete" ImageUrl="~/img/delete.png" runat="server" CausesValidation="False"
            CommandArgument='<%#((GridViewRow) Container).RowIndex %>' CommandName="DeleteC" />
        </ItemTemplate>
        <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
    </Columns>
</asp:GridView>

在android中,
IDE
SDK
不提供此类自动功能


首先,您需要创建自定义
xml布局
,使字段具有选择和删除按钮,然后您必须将该
布局
自定义适配器
一起用于
网格视图
。您可以将
RecyclerView
GridLayoutManager
一起用于相同的目的。你会得到很多关于如何做这些事情的教程。

它们在android中没有直接的功能,在dotnet中,它是表格而不是网格,因为所有行都定义了单个项。为此,您可以使用listView,每个列表项跨越具有选项视图(如delete)的项的属性。当您单击“删除”时,从列表中删除项并调用列表适配器中的notifyDataSetChanged。

我想我可以选择两个,但当我单击另一个时,您的项被取消选中。@shijithmc是的,就是这样。这是非常错误的做法。你应该经常比较最佳答案你的答案更清晰,但如果现在改变,我可能会被阻止。