回覆列表
  • 1 # 使用者9405259858110

    需要的引用

    compile "com.android.support:appcompat-v7:22.2.1"

    compile "com.android.support:recyclerview-v7:22.2.1"1212

    開始敲程式碼

    首先搭建佈局

    主佈局就放了一個RecyclerView

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    >

    <android.support.v7.widget.RecyclerView

    android:id="@+id/recyclerview"

    android:background="#EEEEEE"

    android:scrollbars="vertical"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:orientation="vertical"

    android:overScrollMode="never"

    />

    </RelativeLayout>12345678910111213141234567891011121314

    Item佈局

    com.mjj.slidingbutton.SlidingButtonView 就是自定義的View,繼承水平捲軸

    <com.mjj.slidingbutton.SlidingButtonView xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"

    android:layout_height="100dp"

    android:background="@android:color/white"

    android:layout_marginBottom="1dp"

    >

    <RelativeLayout

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    >

    <TextView

    android:id="@+id/tv_delete"

    android:layout_height="match_parent"

    android:layout_width="80dp"

    android:gravity="center"

    android:layout_toRightOf="@+id/layout_content"

    android:text="刪 除"

    android:background="@drawable/btn_click_red_havebackground"

    android:textColor="#DDFFFFFF"

    />

    <RelativeLayout

    android:id="@+id/layout_content"

    android:layout_width="match_parent"

    android:layout_height="match_parent">

    <TextView

    android:id="@+id/text"

    android:layout_height="match_parent"

    android:layout_width="match_parent"

    android:textSize="50dp"

    android:textColor="#DD000000"

    android:background="@drawable/btn_click_black_havebackground"

    />

    </RelativeLayout>

    </RelativeLayout>

    </com.mjj.slidingbutton.SlidingButtonView>

  • 中秋節和大豐收的關聯?
  • 有8000元買iPad mini 5 +iPhone 11還是買iPhone 11 Pro?