【问题标题】:listview with two buttons and list row click带有两个按钮和列表行单击的列表视图
【发布时间】:2012-01-05 11:38:00
【问题描述】:

我想要一个列表视图,每行都有两个这样的按钮

         ---------------------------------------------------------------
            [TEXTVIEW]                           [BUTTON][TV][BUTTON]
         ---------------------------------------------------------------

这里我有一个用于按钮执行某些功能的 onClick。

除此之外,我还想获取整个列表行的 onItemClick。 点击它会给我rowId,我将用它来调用另一个方法......

在上面提到的需要一些帮助....

public class MyListAdapter extends ArrayAdapter {
    Activity contextACT;

    @Override
    public void notifyDataSetChanged() {
        super.notifyDataSetChanged();
    }

    public MyListAdapter(Activity context) {
        super(context, R.layout.nrrow_of_list_lesson, dummyVal);
        this.contextACT = context;
    }

    public View getView(final int row_position, View convertView,
            ViewGroup parent) {
        LayoutInflater inflator = contextACT.getLayoutInflater();
        final View row = inflator.inflate(R.layout.nrrow_of_list_lesson,
                null);
        final TextView name = (TextView) row.findViewById(R.id.lessonname);
        final TextView period = (TextView) row.findViewById(R.id.TVmid);
        TextView slNumber = (TextView) row.findViewById(R.id.lessonslno);
        final Button increase = (Button) row.findViewById(R.id.BTIncrease);
        final Button decrease = (Button) row.findViewById(R.id.BTDecrease);
}

由于我有一个按钮的 Onclick,我无法获取 rowList 的 onItemClickListener....

【问题讨论】:

  • 在你问哥们之前请先在谷歌搜索,网上有成千上万的例子......!!!
  • Maann 我知道如何获得 CustomList 视图...我只需要知道我是否可以获得列表的 ItemClickListener...你不要在 tat case 中发布一些链接

标签: android


【解决方案1】:

http://www.vogella.de/articles/AndroidListView/article.html你需要根据你的需要使用listview的适配器来定制.....

【讨论】:

  • 哦,是的,我已经完成了......我使用了一个arrayListAdapter......我能够得到一个包含所有属性的列表......我想知道的是,可以我得到 ClickListener 或 List ROw....
  • 嘿伙计 Nikhil 让我发布代码...可能会让你知道我在说什么...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-27
  • 1970-01-01
  • 2021-04-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多