item_menu.xml:
- <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://www.easck.com/apk/res/android"
- android:id="@+id/RelativeLayout_Item" android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:paddingBottom="5dip"> <ImageView android:id="@+id/item_image"
- android:layout_centerHorizontal="true" android:layout_width="40dip"
- android:layout_height="40dip"> </ImageView>
- <TextView android:layout_below="@id/item_image" android:id="@+id/item_text"
- android:layout_centerHorizontal="true" android:layout_width="wrap_content"
- android:layout_height="wrap_content" style="@style/Text.Location"
- android:text="选项"></TextView> </RelativeLayout>
2、用popupwindow作为菜单显示容器:
- View view = this.getLayoutInflater().inflate(R.layout.popwindowdemo, null); pop = new PopupWindow(view,320,450);//大小设置为全屏幕,这里硬编码的,可修改
- pop.setOutsideTouchable(false); pop.setBackgroundDrawable(new BitmapDrawable());
- pop.setFocusable(true);//如果不加这个,Grid不会响应ItemClick pop.setTouchInterceptor(new OnTouchListener() {
- public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub










