Drawer VS pageFlipper,page tunner

Drawer: 点击一个按钮,就像拉抽屉一样展开界面,比较常用的应用是LAUNCH应用。手机的桌面是由几个屏幕的,你可以任意滑动的。这个布局就是一个Workspace。Launcher的Workspace主要的职责就是处理多个屏幕之间的滑动和壁纸的添加。

SlidingDrawer可以在Open和Close两个状态之间切换。Open时覆盖,不是所有的Layout都能支持这种叠加覆盖,作为SlidingDrawer的container,例如LinearLayout就不可以,一般使用RelativeLayout和FrameLayout。

device-2012-02-22-143826.png

SlidingDraw Activity Tut Source

Having a whole new activity allows your code to be separated and lets the Android system look after it’s lifecycle separately.

This tutorial doesn’t have a ‘handle’ in the activity this could be used to open and close the drawer, using the back button is what I have opted for. Adding a slider handler would be pretty easy and you just attach finish(); to its onClickListener.

When you are transitioning between two activities (with an intent) you can set the animation for the activity your leaving and the animation for the activity your going to. The three needed are ‘pull in’push out’ and ‘stay still’. You have to add these to your /res/anim/ folder.

when your sliding drawer activity is started you can call the method overridePendingTransition this will set what animations are used for bringing your activity into view. You can also call this method again when your activity is about to go off screen (i.e. the onPause() method), to set the animation for leaving the activity.

Android的动画效果分为两种,一种是tweened animation(补间动画),第二种是frame by frame animation一般我们用的是第一种补间动画又分为:

    • AlphaAnimation透明度转换
    • RotateAnimation,旋转转换
    • ScaleAnimation,缩放转换
    • TranslateAnimation 位置转换(移动)

在程序中用AnimationUtils.loadAnimation(Context context,int ResourcesId)载入成Animation对象,在需要显示动画效果时,执行需要动画的View的startAnimation方法,传入Animation,即可。切换Activity也可以应用动画效果,在startActivity方法后,执行overridePendingTransition方法,两个参数分别是切换前的动画效果,切换后的动画效果,下面的例子中传入的是两个alpha动画,以实现切换Activity时淡出淡入,渐隐渐现效果。

SlidingDrawer 这个类, 可以垂直或水平滑动,它有俩个View组成,其一是可以拖动的handle,其二是隐藏内容的View. 在布局文件中必须指定handle和content.

  • handle 就是当你点击它的时候,
  • content 要么抽抽屉要么关抽屉

使得SlidingDrawer在屏幕低端,而不会填满整个屏幕

如果设置了属性layout_height=”wrap_content”是不起作用的,在原来的SlidingDrawer中的onMeasure()方法使得layout_height一直都是fill_parent,但是使用layout_height=”固定高度”也是可以!以下重写SlidingDrawer,实现如下效果图(右图效果):

0_1331047454FxAl.gif0_1331047460NTU3.gif

Android抽屉左右两侧挤压傍边布局

123.jpg

    1. slidingdrawer控件如何屏蔽handle点击事件,而只要handle上下/左右滑动事件?
    2. slidingdrawer中的handle在content的外侧边上,我现在想让它到content内容内侧边上,如何实现?
    3. slidingdrawer 默认是覆盖当前布局,如何实现当slidingdrawer拉出来的时候将右侧挤压出去一部分,就好像是人人程序那种效果,但想用slidingdrawer实现?

Allow you to see the text of the page underneath

为了能在翻页的过程中看到下一页的部分内容,在每次翻页之前必须准备两张页面,一张是当前页,另一张是下一页。翻页的过程就是对这两张页面的剪切,组合过程。

A. The CURL means rolling of a page. Shifting pages one on top of another requires 2 pages in Android and one simple animation. The CURL involves a mathematical model with twisting, 3D and shading.

B. In Android, you should interpolate the animations, each in a different path and acceleration, in a way that the shadow and the pages are synchronised. This is almost impossible. Even if you succeed, the performance would be awkward.

Swipe/fling

      
pre-fling→  during fling→  post-fling

Backward Compatibility: support this version and up(higher)

  • ActionBarSherlock makes implementation easier,
  • Compatibility pack can be used for earlier version

support

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: