一個Android布局可以拖動排序子控件:RearrangeableLayout

jopen 10年前發布 | 27K 次閱讀 Android開發 移動開發 RearrangeableLayout

一個Android布局可以拖動排序子控件。

截圖:

一個Android布局可以拖動排序子控件:RearrangeableLayout

使用說明:

當以下布局被添加到activity的之后,所有的子view都是可拖動的。

<com.rajasharan.layout.RearrangeableLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/rearrangeable_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    app:outlineWidth="2dp"
    app:outlineColor="@color/cyan"
    app:selectionAlpha="0.5"
    app:selectionZoom="1.2"
    >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sample Demo"
        android:textSize="30sp"
        android:background="@android:color/darker_gray"
        android:layout_margin="15dp"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sample Demo with very large text that will overflow in width"
        android:textSize="30sp"
        android:background="@android:color/holo_green_light"
        android:layout_margin="15dp"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Medium length text"
        android:textSize="30sp"
        android:background="@android:color/holo_blue_light"
        android:layout_margin="15dp"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sample"
        android:textSize="15sp"
        android:background="@android:color/holo_orange_light"
        android:layout_margin="15dp"
        />
</com.rajasharan.layout.RearrangeableLayout>

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

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