区块链、APP、公众号、小程序、物联网、智能硬件、网站开发新模式,安全,超速,可控。
当前位置:首页 > 资源中心 > Android 自定义的线性布局,里面的UI可以自由拖动
资源详情

Android 自定义的线性布局,里面的UI可以自由拖动


DragLinearLayout:自定义的线性布局,里面的UI可以自由拖动

gradle:

compile 'com.jmedeisis:draglinearlayout:1.1.0'
xml:

<com.jmedeisis.draglinearlayout.DragLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  android:id="@+id/container"  android:layout_width="match_parent" android:layout_height="match_parent" >
    <TextView android:layout_width="match_parent"  android:layout_height="wrap_content"   android:text="@string/text" />
    <ImageView android:layout_width="match_parent"  android:layout_height="120dp"  android:scaleType="centerCrop"   android:src="@drawable/image"/>
    <Button android:id="@+id/button"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="@string/button_text"/>   
</com.jmedeisis.draglinearlayout.DragLinearLayout>

java:
DragLinearLayout dragLinearLayout = (DragLinearLayout) findViewById(R.id.container);
 for(int i = 0; i < dragLinearLayout.getChildCount(); i++){
 View child = dragLinearLayout.getChildAt(i);   dragLinearLayout.setViewDraggable(child, child);
}
final View view = View.inflate(context, R.layout.view_layout, null);
dragLinearLayout.addDragView(view, view.findViewById(R.id.view_drag_handle));  dragLinearLayout.removeDragView(view);
dragLinearLayout.setOnViewSwapListener(new DragLinearLayout.OnViewSwapListener()
 {  @Override public void onSwap(View firstView, int firstPosition, View secondView, int secondPosition)
 {   }
});

GitHub地址:https://github.com/justasm/DragLinearLayout

资源介绍
yue 来源者
资源名称:Android 自定义的线性布局,里面的UI可以自由拖动
格式:zip
大小:1.45M
颜色:
风格:
上传时间:2017-12-05
资源价格:
0.00
你可能在找这些资源
版权所有 © 2017 ymznkf.com. 成都玉目科技有限公司 蜀ICP备17032468号-1