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

Android Metro菜单

今天继续说一下安卓的菜单,之前介绍了:。相信大家对于Metro风格并不陌生,下面就在安卓平台上实现一下这个效果,如图:

                                              \\         

            实现思路:

                               利用动画来实现移动的效果,使用的是TranslateAnimation这个方法。先看一下布局文件:

   activity_main.xml

 

[java]  <?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#000000" 
    android:orientation="vertical" > 
 
    <!-- 第一层 --> 
 
    <LinearLayout 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layout_weight="1" 
        android:orientation="horizontal" > 
 
        <!-- 第一层 横向 --> 
 
 
        <!-- 第一层 横向左 --> 
 
        <LinearLayout 
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent" 
            android:layout_weight="1" 
            android:orientation="vertical" > 
 
            <LinearLayout 
                android:layout_width="fill_parent" 
                android:layout_height="fill_parent" 
                android:layout_weight="1" 
                android:orientation="horizontal" > 
 
                <!-- 1 --> 
 
                <RelativeLayout 
                    android:id="@+id/nine_one" 
                    android:layout_width="fill_parent" 
                    android:layout_height="fill_parent" 
                    android:layout_weight="1" 
                    android:background="#FFFF00" > 
                </RelativeLayout> 
                <!-- 2 --> 
 
                <RelativeLayout 
                    android:id="@+id/nine_two" 
                    android:layout_width="fill_parent" 
                    android:layout_height="fill_parent" 
                    android:layout_weight="1" 
                    android:background="#FFC0CB" > 
                </RelativeLayout> 
            </LinearLayout> 
            <!-- 4 --> 
 
            <RelativeLayout 
                android:id="@+id/nine_four" 
                android:layout_width="fill_parent" 
                android:layout_height="fill_parent" 
                android:layout_weight="1" 
                android:background="#EE30A7" > 
            </RelativeLayout> 
            <!-- 5 --> 
 
            <RelativeLayout 
                android:id="@+id/nine_five" 
                android:layout_width="fill_parent" 
                android:layout_height="fill_parent" 
                android:layout_weight="1" 
                android:background="#EE4000" >&

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