当前位置:操作系统 > 安卓/Android >>

Android 高仿[优酷]圆盘旋转菜单 的实现

目前,用户对安卓应用程序的UI设计要求越来越高,因此,掌握一些新颖的设计很有必要.

比如菜单,传统的菜单已经不能满足用户的需求. 其中优酷中圆盘旋转菜单的实现就比较好.

 


该菜单共分里外三层导航菜单.可以依次从外向里关闭三层菜单,也可以反向打开,并且伴有圆盘旋转的动画效果


首先,看下效果:

 \

 

 

 

 

 

以下是具体的代码及解释:

1. 菜单布局文件:

大家看到主要有三个RalativeLayout,就是大家看到的三层,但是关于图片的倾斜 是怎样实现的呢?实际上是个假象,图片是正放的,里面图像是倾斜的

 

[java]
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 
 
    <RelativeLayout 
        android:layout_width="100dip" 
        android:layout_height="50dip" 
        android:layout_alignParentBottom="true" 
        android:layout_centerHorizontal="true" 
        android:background="@drawable/level1" > 
 
        <ImageButton 
            android:id="@+id/home" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_centerInParent="true" 
            android:background="@drawable/icon_home" /> 
    </RelativeLayout> 
 
    <RelativeLayout 
        android:layout_width="180dip" 
        android:layout_height="90dip" 
        android:layout_alignParentBottom="true" 
        android:layout_centerHorizontal="true" 
        android:id="@+id/level2" 
        android:background="@drawable/level2" > 
 
        <ImageButton 
            android:id="@+id/search" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true" 
            android:layout_margin="10dip" 
            android:background="@drawable/icon_search" /> 
 
        <ImageButton 
            android:id="@+id/menu" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_centerHorizontal="true" 
            android:layout_margin="6dip" 
            android:background="@drawable/icon_menu" /> 
 
        <ImageButton 
            android:id="@+id/myyouku" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true" 
            android:layout_alignParentRight="true" 
            android:layout_margin="10dip" 
            android:background="@drawable/icon_myyouku" /> 
    </RelativeLayout> 
 
    <RelativeLayout 
        android:layout_width="280dip" 
        android:layout_height="140dip" 
        android:layout_alignParentBottom="true" 
        android:layout_centerHorizontal="true" 
        android:id="@+id/level3" 
        android:background="@drawable/level3" > 
 
        <ImageButton 
            android:id="@+id/c1" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true" 
            android:layout_marginBottom="6dip" 
            android:layout_marginLeft="12dip" 
            android:background="@drawable/channel1" /> 
 
        <ImageButton 
            android:id="@+id/c2" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_above="@id/c1" 
            androi

补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,