滚动像棒棒糖的手机应用程序?

时间:2015-02-13 09:33:40

标签: android

UI有3层

  1. 搜索栏
  2. 最近的手机
  3. Tabs& Viewpager的联系人
  4. 我已成功使用此link滚动“搜索栏”,但我想首先滚动“最近的手机”,然后在“联系人的选项卡&查看管理器”中滚动“搜索栏”,类似于手机间隙。

    任何帮助或链接都将受到赞赏。

1 个答案:

答案 0 :(得分:0)

只是一个提示,(如果你是专业开发人员)

https://android.googlesource.com/platform/packages/apps/Dialer/+/android-5.0.2_r1/src/com/android/dialer/widget/OverlappingPaneLayout.java

以上链接是棒棒糖手机应用程序使用的自定义布局。此布局仅适用于棒棒糖手机,因为它们使用棒棒糖特定的api,如nestedscrolling等。

总结android手机应用程序如何使用此布局(layout link):

<com.android.dialer.widget.OverlappingPaneLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/lists_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:animateLayoutChanges="true" >

    <ListView>
        ...//Top pane
        ...// In phone app they show recently dialed number, which gets clipped when scrolled.
    </ListView>

    <FrameLayout>
       // bottom pane
       <ViewPagerTab></ViewPagerTab> // phone app's viewPager tab
       <ListView></ListView>         // below a list view
    </FrameLayout>

</com.android.dialer.widget.OverlappingPaneLayout>

在活动代码(code link)中:

private void setupPaneLayout(OverlappingPaneLayout paneLayout) {
    // TODO: Remove the notion of a capturable view. The entire view be slideable, once
    // the framework better supports nested scrolling. paneLayout.setCapturableView(mViewPagerTabs);
    paneLayout.openPane();
    paneLayout.setPanelSlideCallbacks(mPanelSlideCallbacks);
    paneLayout.setIntermediatePinnedOffset(

    LayoutTransition transition = paneLayout.getLayoutTransition();
    // Turns on animations for all types of layout changes so that they occur for
    // height changes.
    transition.enableTransitionType(LayoutTransition.CHANGING);
}