Android7.0中文文档(API)--- ExpandableListView

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/ExpandableListView.html

ExpandableListView

public class ExpandableListView
extends ListView

java.lang.Object
   ↳android.view.View
    ↳android.view.ViewGroup
     ↳android.widget.AdapterView<android.widget.ListAdapter>
      ↳android.widget.AbsListView
       ↳android.widget.ListView
        ↳android.widget.ExpandableListView


A view that shows items in a vertically scrolling two-level list. This differs from the ListView by allowing two levels: groups which can individually be expanded to show its children. The items come from the ExpandableListAdapter associated with this view.
一个视图,其在垂直滚动2个层次的列表中显示项。这个类与ListView不同,它允许显示2个层级:组项可以被单独地展开,以显示子项。这些项来自与此视图关联的ExpandableListAdapter

Expandable lists are able to show an indicator beside each item to display the item's current state (the states are usually one of expanded group, collapsed group, child, or last child). Use setChildIndicator(Drawable) or setGroupIndicator(Drawable) (or the corresponding XML attributes) to set these indicators (see the docs for each method to see additional state that each Drawable can have). The default style for an ExpandableListView provides indicators which will be shown next to Views given to the ExpandableListView. The layouts android.R.layout.simple_expandable_list_item_1 and android.R.layout.simple_expandable_list_item_2 (which should be used with SimpleCursorTreeAdapter) contain the preferred position information for indicators.
可扩展的列表可以在每个项目旁边显示一个指示器来显示项目的当前状态(状态通常是这些之一:已展开的组项,已折叠的组项,子项,或最后一个子项)。使用setChildIndicator(Drawable)setChildIndicator(Drawable)(或者对应的XML属性),来设置在这些指示器(请参考每个方法的文档,以查看每个drawable拥有的额外状态)。ExpandableListView的默认样式提供了一些指示器,这些指示器显示在ExpandableListView视图的旁边。android.R.layout.simple_expandable_list_item_1或android.R.layout.simple_expandable_list_item_2(使用SimpleCursorTreeAdapter)布局包含用于指示器的首选位置信息。

The context menu information set by an ExpandableListView will be a ExpandableListView.ExpandableListContextMenuInfo object with packedPosition being a packed position that can be used with getPackedPositionType(long) and the other similar methods.
ExpandableListView是设置的上下文菜单的信息是一个ExpandableListView.ExpandableListContextMenuInfo对象,其包含packedPosition字段作为一个包装位置,可以给getPackedPositionType(long)和其他类似的方法使用。

Note: You cannot use the value wrap_content for the android:layout_height attribute of a ExpandableListView in XML if the parent's size is also not strictly specified (for example, if the parent were ScrollView you could not specify wrap_content since it also can be any length. However, you can use wrap_content if the ExpandableListView parent has a specific size, such as 100 pixels.
注意:如果父项的大小也没有被严格地指定,则你不能在XML中给ExpandableListView的android:layout_height属性赋予wrap_content的值。(例如,父项是ScrollView,则你不能指定wrap_content,因为它也可以是任意长度。)但是,如果ExpandableListView的父项是指定了大小,如100像素,则你可以使用wrap_content。

摘要


嵌套类

classExpandableListView.ExpandableListContextMenuInfo

Extra menu information specific to an ExpandableListView provided to the onCreateContextMenu(ContextMenu, View, ContextMenuInfo) callback when a context menu is brought up for this AdapterView. 
当为这个AdapterView弹出一个上下文菜单时,提供给onCreateContextMenu(ContextMenu, View, ContextMenuInfo)方法的额外的菜单信息。 

interfaceExpandableListView.OnChildClickListener

Interface definition for a callback to be invoked when a child in this expandable list has been clicked. 
回调的接口定义,当此可扩展列表内的一个子项被点击时调用。 

interfaceExpandableListView.OnGroupClickListener

Interface definition for a callback to be invoked when a group in this expandable list has been clicked. 
回调的接口定义,当此可扩展列表内的一个组项被点击时调用。 

interfaceExpandableListView.OnGroupCollapseListener

Used for being notified when a group is collapsed  
用于当组项折叠时的通知。  

interfaceExpandableListView.OnGroupExpandListener

Used for being notified when a group is expanded  
用于当组项展开时的通知。  

XML属性


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值