代码如下

package com.yq1012.youku;

import android.support.v4.app.Fragment;

import android.transition.ChangeBounds;

import android.app.Activity;

import android.os.Bundle;

import android.view.KeyEvent;

import android.view.LayoutInflater;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.view.View.OnClickListener;

import android.view.ViewGroup;

import android.widget.ImageView;

import android.widget.RelativeLayout;

import android.os.Build;

public class MainActivity extends Activity implements OnClickListener {

private boolean isLever2Show = true;

private boolean isLever3Show = true;

private boolean isLever1Show = true;

private ImageView icon_menu;

private ImageView icon_home;

private RelativeLayout level1;

private RelativeLayout level2;

private RelativeLayout level3;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

icon_menu = (ImageView) findViewById(R.id.iv_menu);

icon_home = (ImageView) findViewById(R.id.iv_home);

level1 = (RelativeLayout) findViewById(R.id.rl_level1);

level2 = (RelativeLayout) findViewById(R.id.rl_level2);

level3 = (RelativeLayout) findViewById(R.id.rl_level3);

icon_menu.setOnClickListener(this);

icon_home.setOnClickListener(this);

}

@Override

public void onClick(View v) {

switch (v.getId()) {

case R.id.iv_menu:

if (isLever3Show) {

// 如果是 3级菜单是显示 就隐藏

MyUtil.startAnimOut(level3);

} else {

// 隐藏 。。

MyUtil.startAnimIn(level3);

}

isLever3Show = !isLever3Show;

break;

case R.id.iv_home:

if (isLever2Show) {

// 如果是 3级菜单是显示 就隐藏

MyUtil.startAnimOut(level2);

isLever2Show = false;

if (isLever3Show) {// 存在的第3级也在将其隐藏

MyUtil.startAnimOut(level3, 200);

isLever3Show = false;

}

} else {

// 隐藏 。。

MyUtil.startAnimIn(level2);

isLever2Show = true;

}

break;

default:

break;

}

}

@Override

public boolean onKeyDown(int keyCode, KeyEvent event) {

if (keyCode == KeyEvent.KEYCODE_MENU) {// 监听menu按键

chageLevel1State();

}

return super.onKeyDown(keyCode, event);

}

/**

*

*/

private void chageLevel1State() {

if (isLever1Show) {

MyUtil.startAnimOut(level1);

isLever1Show = false;

if (isLever2Show) {

MyUtil.startAnimOut(level2,200);

isLever2Show = false;

if (isLever3Show) {

MyUtil.startAnimOut(level3,100);

isLever3Show = false;

}

}

}else{

MyUtil.startAnimIn(level1);

isLever1Show = true;

MyUtil.startAnimIn(level2,200);

isLever2Show = true;

}

}

}

界面如下

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:paddingBottom="@dimen/activity_vertical_margin"

android:paddingLeft="@dimen/activity_horizontal_margin"

android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

tools:context="com.yq1012.youku.MainActivity$PlaceholderFragment" >

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerHorizontal="true"

android:layout_centerVertical="true"

android:text="@string/hello_world" />

android:id="@+id/rl_level1"

android:layout_width="90dp"

android:layout_height="50dp"

android:layout_alignParentBottom="true"

android:layout_centerHorizontal="true"

android:background="@drawable/level1"

android:gravity="center" >

android:id="@+id/iv_home"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:src="@drawable/icon_home" />

android:id="@+id/rl_level2"

android:layout_width="180dp"

android:layout_height="90dp"

android:layout_alignBottom="@+id/rl_level1"

android:layout_centerHorizontal="true"

android:background="@drawable/level2" >

android:id="@+id/iv_search"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:layout_margin="10dp"

android:background="@drawable/icon_search" />

android:id="@+id/iv_menu"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerHorizontal="true"

android:layout_marginTop="5dp"

android:background="@drawable/icon_menu" />

android:id="@+id/iv_myyouku"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:layout_alignParentRight="true"

android:layout_margin="10dp"

android:background="@drawable/icon_myyouku" />

android:id="@+id/rl_level3"

android:layout_width="280dp"

android:layout_height="140dp"

android:layout_alignBottom="@+id/rl_level2"

android:layout_centerHorizontal="true"

android:background="@drawable/level3" >

android:id="@+id/channel1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:layout_marginBottom="10dp"

android:layout_marginLeft="10dp"

android:background="@drawable/channel1" />

android:id="@+id/channel2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_above="@id/channel1"

android:layout_alignLeft="@id/channel1"

android:layout_marginBottom="10dp"

android:layout_marginLeft="20dp"

android:background="@drawable/channel2" />

android:id="@+id/channel4"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerHorizontal="true"

android:layout_marginTop="5dp"

android:src="@drawable/channel4" />

android:id="@+id/channel7"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:layout_alignParentRight="true"

android:layout_marginBottom="10dp"

android:layout_marginRight="10dp"

android:background="@drawable/channel7" />

android:id="@+id/channel6"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_above="@id/channel7"

android:layout_alignRight="@id/channel7"

android:layout_marginBottom="10dp"

android:layout_marginRight="20dp"

android:background="@drawable/channel6" />

android:id="@+id/channel5"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_above="@+id/channel6"

android:layout_toLeftOf="@+id/channel6"

android:background="@drawable/channel5" />

android:id="@+id/channel3"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignTop="@+id/channel5"

android:layout_toRightOf="@+id/channel2"

android:background="@drawable/channel3" />

这个界面很适合熟练 RelativeLayout

my android tools优酷,优酷环形菜单-安卓相关推荐

  1. Android 高仿【优酷】圆盘旋转菜单的实现

    目前,用户对安卓应用程序的UI设计要求越来越高,因此,掌握一些新颖的设计很有必要. 比如菜单,传统的菜单已经不能满足用户的需求. 其中优酷中圆盘旋转菜单的实现就比较优秀,这里我提供下我的思路及实现,仅 ...

  2. android仿优酷菜单,Android编程实现仿优酷旋转菜单效果(附demo源码)

    本文实例讲述了Android编程实现仿优酷旋转菜单效果.分享给大家供大家参考,具体如下: 首先,看下效果: 不好意思,不会制作动态图片,只好上传静态的了,如果谁会,请教教我吧. 首先,看下xml文件: ...

  3. android 双层旋转菜单,Android 高仿【优酷】圆盘旋转菜单的实现

    目前,用户对安卓应用程序的UI设计要求越来越高,因此,掌握一些新颖的设计很有必要. 比如菜单,传统的菜单已经不能满足用户的需求. 其中优酷中圆盘旋转菜单的实现就比较优秀,这里我提供下我的思路及实现,仅 ...

  4. android 优酷 自动全屏播放,Android如何实现仿优酷视频的悬浮窗播放效果

    Android如何实现仿优酷视频的悬浮窗播放效果 发布时间:2020-07-11 10:24:43 来源:亿速云 阅读:228 作者:清晨 这篇文章主要介绍Android如何实现仿优酷视频的悬浮窗播放 ...

  5. 软酷优计划java考试复习题_软酷题

    1111 1下面哪些是软酷网重要频道?ABCD A.软酷实践平台 B.软酷优计划平台 C.软酷酷团队 D.在线答疑 2软酷实训在哪里进行?D A.机房 B.教室 C.会议室 D.软酷卓越实验室 3软酷 ...

  6. php 读取优酷视频缩略图,PHP优酷土豆酷6采集入库函数(获取视频缩略图,视频swf地址,视频标题)...

    /** * 采集入库函数 * 优酷,土豆,酷6 采集 (自动获取视频缩略图,视频swf地址,视频标题) * by hkshadow * QQ 2765237 * dete: 2011-06-25 AM ...

  7. 【UI学习】Android github开源项目,酷炫自定义控件(View)汇总

    [UI学习]Android github开源项目,酷炫自定义控件(View)汇总 转载  2016年09月04日 23:23:15 3484 近期整理的比较酷炫并且我们会经常用到的custom vie ...

  8. 腾讯优测-优社区干货精选 | android开发在路上:少去踩坑,多走捷径(上)

    文/腾讯公司 陈江峰 优测小优有话说: android开发的坑自然是不少,不想掉坑快来优测优社区~ 最近一朋友提了几个Android问题让我帮忙写个小分享,我觉得对新人还是挺有帮助的.于是在原基础上针 ...

  9. 腾讯优测-优社区干货精选 | android开发在路上:少去踩坑,多走捷径(上)

    文/腾讯公司 陈江峰 优测小优有话说: android开发的坑自然是不少,不想掉坑快来优测优社区~ 最近一朋友提了几个Android问题让我帮忙写个小分享,我觉得对新人还是挺有帮助的.于是在原基础上针 ...

最新文章

  1. 1 Zookeeper安装
  2. MIPI参数配置解释
  3. 【OpenCV学习】OpenMP并行化实例
  4. java-log入门【目的把日志写入socket】
  5. 链表 java详解_链表详解——Java版
  6. Android:Eclipse如何删除ADT
  7. 视觉检测无脊椎机器人或vipir_深入浅出人工智能前沿技术—机器视觉检测,看清人类智慧工业...
  8. python列表排序方法-python list排序的两种方法及实例讲解
  9. 自定义控件常用方法总结
  10. mysql实现俩个属性加减运算_1.3 算数运算符
  11. python微博_「Python」 - 微博数据分析
  12. 信息安全技术 实验3 木马及远程控制技术
  13. 关于分布函数连续性的运用
  14. 关于Webgl实际中遇到的一些坑,与大家分享。
  15. php简单答题系统,念做个简易php选择题答题系统
  16. 节奏大师服务器不稳定,《节奏大师》停服是怎么回事 暂停运营维护优化
  17. struct usb_driver
  18. lol手游修改服务器,英雄联盟官方修改大区的方法
  19. iOS微信实现第三方登录的方法
  20. 青软新获「2022年度山东省软件和信息技术服务业综合竞争力百强企业」等三项荣誉!

热门文章

  1. 新iPhone SE曝光:苹果启用新外形
  2. 怎么拍照识别植物?掌握这招轻松分辨植物
  3. 定时器/计数器使用示例(c语言程序)
  4. 触摸屏是什么意思,触摸屏种类及特点有哪些
  5. CS231A:Pinhole camera model and lenses
  6. 增加linux服务器根目录空间大小方法
  7. 20幅妙不可言的光涂鸦摄影作品
  8. 检测服务器是否开启重协商功能(用于CVE-2011-1473漏洞检测)
  9. 45个纯 CSS 实现的精美边框效果【附源码】【上篇】
  10. MySQL索引与查询优化