【问题标题】:want to edit the textView in listView想编辑 listView 中的 textView
【发布时间】:2013-06-27 08:29:03
【问题描述】:

一个表格行(带有 4 个 TextView)在一个布局中,而 listView 在另一个布局中。想要编辑列表中的 textView 之一。

ListAdapter adapter = new SimpleAdapter(this, contactList,
            R.layout.list_item,
            new String[] { "Barcode", "Division", "Mrp","qty" }, new int[] {
                    R.id.txt, R.id.txt1, R.id.mrp,R.id.qty1 });

    setListAdapter(adapter);

想在每次绑定行时编辑列表中的数量...

【问题讨论】:

    标签: android list listview adapter android-tablelayout


    【解决方案1】:

    那么不要给它传递一个新的字符串数组。将您传递的字符串数组存储在一个变量中。当你想更新它时,改变数组中适当的字符串,然后在适配器上调用 notifyDataSetUpdate() 让它重新加载它的数据。

    【讨论】:

    • 您好,谢谢您的回复..我是 android 新手..所以您有任何关于您的想法的样本吗...
    【解决方案2】:
             ListAdapter adapter = new SimpleAdapter(this, contactList,
                    R.layout.list_item,
                    new String[] { "Barcode", "Division", "Mrp","**quantity**" }, new int[] {
                    R.id.txt, R.id.txt1, R.id.mrp,R.id.qty1 });
    
              setListAdapter(adapter);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-17
      • 1970-01-01
      相关资源
      最近更新 更多