too*_*o42 6 android contextmenu popupmenu expandablelistview onclicklistener
所以我的ExpandableListView
组行定义如下:
group_row.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/GroupName"
style="@style/ListViewRowStyle"
android:paddingLeft="40dp"
android:textSize="18sp" >
</TextView>
<ImageView
android:id="@+id/Menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:contentDescription="@string/default_content_description_text"
android:src="@drawable/ic_menu_moreoverflow_normal_holo_light" >
</ImageView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
当您单击TextView
它时,它将展开或折叠,具体取决于当前是否显示子行.我附上了OnClickListener
该ImageView
组一行.ImageView
单击此按钮时,我会启动PopupMenu
如下图像:
一旦PopupMenu
显示和动作中的一个被点击,我想在该组的所有儿童执行操作.问题是我无法确定ImageView
单击的行.
我弄清楚如何将动作应用于所有孩子的唯一方法是使用ContextMenu
如下图像:
我想避免使用a,ContextMenu
因为组行上的LongClick可能不明显,用户无法确定它会在子行上执行某些操作.我认为更明显的设计是将a锚定PopupMenu
到ImageView
(在我的情况下是菜单图标)并将操作应用于该组的子行.我怎样才能获得这个功能PopupMenu
?
归档时间: |
|
查看次数: |
11282 次 |
最近记录: |