易采站长站为您分析Android实现模仿UCweb菜单效果的方法,较为详细的分析了Android模仿UCweb菜单效果的页面布局及功能实现技巧,具有一定参考借鉴价值,需要的朋友可以参考下
本文实例讲述了Android实现模仿UCweb菜单效果的方法。。具体如下:
UCWeb的菜单看起来不错,自己模仿做一个,思路实现如下:
1、保留menu按键作用
2、用popupwindow作为菜单显示容器
3、用GridView显示所有子菜单
代码如下:
1、布局文件:
popupwindow.xml:
- <?xml version="1.0" encoding="utf-8"?> <LinearLayout
- xmlns:android="http://www.easck.com/apk/res/android" android:layout_width="fill_parent"
- android:background="#50000000" android:layout_height="fill_parent"
- android:gravity="bottom|center_horizontal"> <LinearLayout
- xmlns:android="http://www.easck.com/apk/res/android" android:layout_width="320dip"
- android:background="@drawable/bkg2" android:id="@+id/popdialog"
- android:layout_height="250dip" android:gravity="center_vertical|center_horizontal"
- > <GridView
- android:id="@+id/gridview" android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:numColumns="4"
- android:verticalSpacing="10dip" android:horizontalSpacing="10dip"
- android:stretchMode="columnWidth" android:gravity="center"
- /> </LinearLayout>
- </LinearLayout>










