用ViewDragHelper實現的activity切換動畫:Dragger

jopen 9年前發布 | 34K 次閱讀 Dragger Android開發 移動開發

介紹:

用ViewDragHelper實現的activity切換動畫。

運行效果:

使用說明:

 

你可以將這個庫當成view來用:

將DraggerView添加到root layout,并且在里面加入兩個layout。

<com.github.library.DraggerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    dragger_layout:drag_view_id="@+id/drag_view"
    dragger_layout:shadow_view_id="@+id/shadow_view"
    dragger_layout:drag_position="top">

    <FrameLayout
          android:id="@+id/shadow_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/transparent"
          android:visibility="invisible"/>

      <LinearLayout
          android:id="@+id/drag_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent"/>

</com.github.library.DraggerView>

style文件中這樣設置

<style name="YourTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:windowIsTranslucent">true</item>
      <item name="android:windowBackground">@android:color/transparent</item>
      <item name="android:windowNoTitle">true</item>
      <item name="windowActionBar">false</item>
      <item name="android:windowAnimationStyle">@null</item>
</style>

manifest中

<activity
    android:name="com.github.dragger.BaseActivity"
    android:theme="@style/YourTheme"/>

項目主頁:http://www.baiduhome.net/lib/view/home/1427960994100

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!