my android tools优酷,优酷环形菜单-安卓
代码如下
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优酷,优酷环形菜单-安卓相关推荐
- Android 高仿【优酷】圆盘旋转菜单的实现
目前,用户对安卓应用程序的UI设计要求越来越高,因此,掌握一些新颖的设计很有必要. 比如菜单,传统的菜单已经不能满足用户的需求. 其中优酷中圆盘旋转菜单的实现就比较优秀,这里我提供下我的思路及实现,仅 ...
- android仿优酷菜单,Android编程实现仿优酷旋转菜单效果(附demo源码)
本文实例讲述了Android编程实现仿优酷旋转菜单效果.分享给大家供大家参考,具体如下: 首先,看下效果: 不好意思,不会制作动态图片,只好上传静态的了,如果谁会,请教教我吧. 首先,看下xml文件: ...
- android 双层旋转菜单,Android 高仿【优酷】圆盘旋转菜单的实现
目前,用户对安卓应用程序的UI设计要求越来越高,因此,掌握一些新颖的设计很有必要. 比如菜单,传统的菜单已经不能满足用户的需求. 其中优酷中圆盘旋转菜单的实现就比较优秀,这里我提供下我的思路及实现,仅 ...
- android 优酷 自动全屏播放,Android如何实现仿优酷视频的悬浮窗播放效果
Android如何实现仿优酷视频的悬浮窗播放效果 发布时间:2020-07-11 10:24:43 来源:亿速云 阅读:228 作者:清晨 这篇文章主要介绍Android如何实现仿优酷视频的悬浮窗播放 ...
- 软酷优计划java考试复习题_软酷题
1111 1下面哪些是软酷网重要频道?ABCD A.软酷实践平台 B.软酷优计划平台 C.软酷酷团队 D.在线答疑 2软酷实训在哪里进行?D A.机房 B.教室 C.会议室 D.软酷卓越实验室 3软酷 ...
- php 读取优酷视频缩略图,PHP优酷土豆酷6采集入库函数(获取视频缩略图,视频swf地址,视频标题)...
/** * 采集入库函数 * 优酷,土豆,酷6 采集 (自动获取视频缩略图,视频swf地址,视频标题) * by hkshadow * QQ 2765237 * dete: 2011-06-25 AM ...
- 【UI学习】Android github开源项目,酷炫自定义控件(View)汇总
[UI学习]Android github开源项目,酷炫自定义控件(View)汇总 转载 2016年09月04日 23:23:15 3484 近期整理的比较酷炫并且我们会经常用到的custom vie ...
- 腾讯优测-优社区干货精选 | android开发在路上:少去踩坑,多走捷径(上)
文/腾讯公司 陈江峰 优测小优有话说: android开发的坑自然是不少,不想掉坑快来优测优社区~ 最近一朋友提了几个Android问题让我帮忙写个小分享,我觉得对新人还是挺有帮助的.于是在原基础上针 ...
- 腾讯优测-优社区干货精选 | android开发在路上:少去踩坑,多走捷径(上)
文/腾讯公司 陈江峰 优测小优有话说: android开发的坑自然是不少,不想掉坑快来优测优社区~ 最近一朋友提了几个Android问题让我帮忙写个小分享,我觉得对新人还是挺有帮助的.于是在原基础上针 ...
最新文章
- 1 Zookeeper安装
- MIPI参数配置解释
- 【OpenCV学习】OpenMP并行化实例
- java-log入门【目的把日志写入socket】
- 链表 java详解_链表详解——Java版
- Android:Eclipse如何删除ADT
- 视觉检测无脊椎机器人或vipir_深入浅出人工智能前沿技术—机器视觉检测,看清人类智慧工业...
- python列表排序方法-python list排序的两种方法及实例讲解
- 自定义控件常用方法总结
- mysql实现俩个属性加减运算_1.3 算数运算符
- python微博_「Python」 - 微博数据分析
- 信息安全技术 实验3 木马及远程控制技术
- 关于分布函数连续性的运用
- 关于Webgl实际中遇到的一些坑,与大家分享。
- php简单答题系统,念做个简易php选择题答题系统
- 节奏大师服务器不稳定,《节奏大师》停服是怎么回事 暂停运营维护优化
- struct usb_driver
- lol手游修改服务器,英雄联盟官方修改大区的方法
- iOS微信实现第三方登录的方法
- 青软新获「2022年度山东省软件和信息技术服务业综合竞争力百强企业」等三项荣誉!