Skip to content

Instantly share code, notes, and snippets.

@SIMMORSAL
Created December 1, 2017 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SIMMORSAL/1e371d9500f2fbddb6d31f4b39ad9b03 to your computer and use it in GitHub Desktop.
Save SIMMORSAL/1e371d9500f2fbddb6d31f4b39ad9b03 to your computer and use it in GitHub Desktop.
View Drag Layout
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The views behind the draggable layout =================== -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5">
<Button
android:id="@+id/btnShowLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="show draggable layout" />
<pl.droidsonroids.gif.GifImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/droid_dance" />
</RelativeLayout>
<!-- =================== The views behind the draggable layout -->
<!-- the dragging and related views ========================== -->
<ImageView
android:id="@+id/imgDarkOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e0000000" />
<LinearLayout
android:id="@+id/linDraggable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E91E63"
android:clickable="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginBottom="30dp"
android:src="@drawable/android_apps"
android:tint="#fff" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="This is a draggable Linear Layout"
android:textColor="#fff"
android:textSize="20sp" />
</LinearLayout>
<View
android:id="@+id/viewTouchListener"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- ========================== the dragging and related views -->
</FrameLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment