我如何铺开在我的Andr​​oid应用程序对此有何看法? [英] How do I roll out this view in my Android application?

查看:127
本文介绍了我如何铺开在我的Andr​​oid应用程序对此有何看法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Andr​​oid项目复杂的ListView 涉及的布局,看起来像附图片。布局具有顶部,固定部分(会议详细信息)以的TextView 取值加入编辑删除为可点击(真正听取 onTouch 事件),与修改删除只显示了本次会议所有者/创建者。

I have a complex ListView involved layout in my Android project that looks something like the picture attached. The layout has a top, fixed part (the meeting details) with TextViews Join, Edit and Delete that are clickable (really listen to onTouch events), with Edit and Delete only showing up for the meeting owner/creator.

有,然而,固定部分下的的ListView 部分为好,这部分有一些未知的意见,presumably张贴谁拥有人被邀请参加会议。任何人的帐户可以访问这个会议,谁看到这样的布局可以在本次会议上的信息布局发表评论。但是,只有一个人创建的注释有链接修改删除(同​​样, onTouch 那些的TextView S)的听众。通过这种方式,认为这页的详细信息页面,当你点击帖子在Facebook上,你会看到所有的评论贴,但只能够编辑/删除你自己的意见。

There is, however, the ListView part below the fixed part as well, and this part has a number of unknown comments, presumably posted by people who have been invited to the meeting. Anyone whose account has access to this meeting, and who sees this layout can comment on this meeting information layout. However, only comments created by a person have the links Edit or Delete (again, onTouch listeners on those TextViews). In this way, think of this page as the detail page when you click on post in Facebook and you see all the comments posted, but are only able to edit/delete your own comments.

我以为我可以载像一个解决方案页面,顶,固定部分,在相同的片段布局的ListView ,但如果我有所有的意见相同的链接,只会工作。这是不适合我的情况下,因为链接修改删除为每个评论,如果评论仅会是评论作者。

I thought I could set out with a solution like this page, with the top, fixed part and the ListView in the same fragment layout, but that will only work if I have the same links for all the comments. That is not the case for me, because the links Edit and Delete for each comment will only show up if the comment is by the comment author.

我应该怎么做呢?我必须写我自己的适配器?这是唯一的方法是什么?我将如何去写我自己的适配器?任何指针/教程/ AP连接preciated。

How should I do this? Do I have to write my own Adapter? Is that the only way? How would I go about writing my own Adapter? Any pointers/tutorials/links appreciated.

最后,我想知道我怎么能对上的评论点击每个项目设置监听器。我知道我必须使用 setTag() getTag(),但不知道在哪里做到这一点。

Lastly, I was wondering how I can set listeners for each clickable item on the comments. I know I have to use setTag() and getTag(), but don't know where to do this.

任何帮助深表AP preciated。

Any help is deeply appreciated.

推荐答案

Vogella.com有一些很好的android教程。 这里是一个用于编写自定义适配器。 Android的文档也对列表视图的教程,但它看起来并不像他们告诉你如何做定制的适配器。他们这样做,不过,告诉你如何处理的列表视图中点击。

Vogella.com has some good android tutorials. Here is one for writing a custom adapter. The android docs also have a tutorial on listviews, but it doesn't look like they tell you how to do custom adapters. They do, however, tell you how to handle clicks on the list view.

您可以设置您的评论视图来显示修改删除按钮或不在 getView()你的 BaseAdapter 类的方法。

You can setup your comment view to display the Edit and Delete buttons or not in the getView() method of your BaseAdapter class.

这篇关于我如何铺开在我的Andr​​oid应用程序对此有何看法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆