我的问题:如何添加导航抽屉可拖动图标
我想在抽屉式导航添加可拖动图标。
抽屉打开时,此图标与导航抽屉的列表视图组合。
看到这样类似的,
我都试过了,
我搜索在StackOverflow上像类似的问题这一点,
Draggable drawer with a handle (instead of action bar) on top of other apps
但所有的答案建议第三方图书馆。
我的问题
1.It`s可以添加导航抽屉可拖动图标?
我的问题:如何添加导航抽屉可拖动图标
我想在抽屉式导航添加可拖动图标。
抽屉打开时,此图标与导航抽屉的列表视图组合。
看到这样类似的,
我都试过了,
我搜索在StackOverflow上像类似的问题这一点,
Draggable drawer with a handle (instead of action bar) on top of other apps
但所有的答案建议第三方图书馆。
我的问题
1.It`s可以添加导航抽屉可拖动图标?
对于drag layout
有的GitHub库它
您可以从左至右或任何地方拖动这是有用的。它也会从左向右滑动&也拖动也是可以的。 Drag Layout link
<RelativeLayout
android:id="@id/left_big_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF00FFFF">
<TextView android:text="LEFT"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
<ImageView android:id="@id/left_big_handle"
android:background="@drawable/handle"
android:layout_gravity="top"
android:layout_marginTop="12dp"
android:layout_width="24dp"
android:layout_height="80dp"/>
</com.kedzie.drawer.DraggedDrawer>
handle.xml手柄提拉文件
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/status_bar_close_red" />
<item android:drawable="@drawable/status_bar_close_off" />
</selector>
截图
希望这对你有用。
是的..我的问题解决了..感谢 –
很高兴帮助你@Ranjith –
我想要类似的可拖动导航抽屉only..not coc :) –
据我可以告诉看到DrawerLayout源代码它不能完全按照你想要的。 (https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v4/java/android/support/v4/widget/DrawerLayout.java)所以要么你必须使用一个库,或者你应该子类化DrawerLayout并创建你自己的ViewDragHelper,它的行为就像你想要的那样。 (了解原理,看看这里:http://flavienlaurent.com/blog/2013/08/28/each-navigation-drawer-hides-a-viewdraghelper/) –
真的很感谢@jmols ..我会试试这个。 –