我怎样才能复制此UI模式:点击ListView项并展开它下面? [英] How can I replicate this UI pattern: click ListView item and expand below it?

查看:132
本文介绍了我怎样才能复制此UI模式:点击ListView项并展开它下面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,在应用程序羽,当你点击一个ListView项目(鸣叫),它扩展其下表现出一定的操作(回复,链接,转推等)。我怎样才能复制在我的应用程序这种行为?我希望能够点击一个ListView项目,然后展开与我自己的操作(选择的项目)。

For example, in the application Plume, when you click on a ListView item (a tweet), it expands beneath it to show some actions (reply, links, retweet, etc.). How can I replicate this behavior in my application? I want to be able to click a ListView item and then "expand" it with my own actions (for the item selected).

截图例如:

什么是这里所使用的UI设计模式?

What is the UI design pattern being used here?

推荐答案

您必须创建它自己。你应该创建一个扩展自定义适配器 BaseExpandableListAdapter getChildView 你应该把这些按钮在一个水平的LinearLayout TextViews ,并设置的TextView 机器人:drawableTop 与您要使用的图标

You have to create it for yourself. You should create a custom adapter which extends BaseExpandableListAdapter and in getChildView you should put the buttons in a horizontal LinearLayout with TextViews and set the TextView's android:drawableTop with the icons you want to use.

一个非常简单的使用此布局的:

A very simple use of this layout:

<LinearLayout 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/replyText"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:text="@string/app_name"
            android:drawableTop="@drawable/ic_launcher" />
        <TextView
            android:id="@+id/someText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/app_name"
            android:layout_margin="5dp"
            android:drawableTop="@drawable/ic_launcher" />
        <TextView
            android:id="@+id/otherText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:text="@string/app_name"
            android:drawableTop="@drawable/ic_launcher" />

</LinearLayout>

您可以使用您可绘制和字符串。这只是一种方法。

You can use your drawables and strings. It's just an approach.

这篇关于我怎样才能复制此UI模式:点击ListView项并展开它下面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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