android 的 launcher 有一个抽屉效果,可以有拉出和关闭的效果. 这里主要讨论如何实现这种效果.
将slidingdraw 控件添加到相关的layout中
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<SlidingDrawer
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:handle="@+id/handle"
android:content="@+id/content" >
<Button
android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/handle" />
<LinearLayout
android:id="@+id/content"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:width="wrap_content"
android:height="wrap_content"
android:text="@string/hello"
</LinearLayout>
</SlidingDrawer>
</LinearLayout>
有几个属性要注意, 先说slidingdrawer的属性.
android:handle="@+id/handle" 这个属性指定的是那一个控件的相应将启动这个SlidingDraw 这里是一个Button控件
android:content="@+id/content" 这个属性指定的SlidingDrawer的内容,若是SlidingDraw启动后, 应该调出那个内容,这里是一个linelayout
除此之外, Button里面设置了一个selector, android:background="@drawable/handle", 这样在不同的响应中就有不同的背景
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/tray_handle_normal" />
<item android:state_pressed="true" android:drawable="@drawable/tray_handle_pressed" />
<item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/tray_handle_selected" />
<item android:state_enabled="true" android:drawable="@drawable/tray_handle_normal" />
<item android:state_focused="true" android:drawable="@drawable/tray_handle_selected" />
</selector>
分享到:
相关推荐
Aj_01 来自:http://blog.csdn.net/Android_Tutor/archive/2010/04/14/5486804.aspx 测试:Android Launcher抽屉类SlidingDrawer的使用!
SlidingDrawer隐藏屏外的内容,并允许用户通过handle以显示隐藏内容。该demo演示了SlidingDrawer应用及效果。
使用ViewPager实现高仿launcher拖动效果.rar,太多无法一一验证是否可用,程序如果跑不起来需要自调,部分代码功能进行参考学习。
Android 拆解Launcher中的WorkSpace实现左右滑动效果
Android中实现Launcher功能之添加快捷方式
Launcher3 去掉应用抽屉
ViewPager 使用ViewPager实现高仿launcher拖动效果.rar
launcher3动画效果源码,只供学习使用。
使用ViewPage实现类launcher滑动
本文实例讲述了Android7.0开发实现Launcher3去掉应用抽屉的方法。分享给大家供大家参考,具体如下: 年初做过一个项目,有一个需求就是需要将桌面变为单层不需要二级菜单。最近几次有小伙伴有这个问我这个解决办法。...
仿照Launcher的Workspace实现左右滑动切换,学习用不错!
Android实现图标拖拽.rar,太多无法一一验证是否可用,程序如果跑不起来需要自调,部分代码功能进行参考学习。
7.1 8.1 9.0 10.0 两个launcher之间切换,设置默认launcher
仿launcher主界面滚动效果,引用android第三包更快的实现效果
主要介绍了Android开发实现Launcher3应用列表修改透明背景的方法,结合实例形式分析了Launcher3相关配置文件与功能函数修改设置操作技巧,需要的朋友可以参考下
Arctium WoW Client Launcher 27377版本。 HOWTO: 安装方法: 1.Use 7zip/WinRAR to extract the archive into your wow folder. 1.用解压软件将压缩包内容解压到WOW文件夹内,即将Arctium WoW Client Launcher....
Android 8.1 Launcher3去掉了主菜单抽屉,所有应用加载在workspaces页面
软件名称:Blinq Launcher APK名称:...●大量抽屉过渡效果 ●自定义网格尺寸 ●半透明导航栏 ●支持其他桌面图标应用 ●手势快捷键 ●支持消息数 ●独家的 Blinq壁纸 (感谢银色沙滩和来世远离的发现)