drawable類 有兩個xml文件:
第一個xml;
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<solid android:color="#FF0080" /> <!-- 定義填充的顏色值 -->
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<!-- 設置圓角矩形 -->
<corners android:radius="100dp" />
<stroke android:width="2dp" android:color="#FFFF00" />
</shape>
第二個xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<!-- 設置圓角矩形 -->
<corners android:radius="1dp" />
<stroke android:width="0.5dp" android:color="#000000" />
</shape>
layout下 有兩個xml文件:
第一個主佈局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical"
tools:context="com.example.video_.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:paddingLeft="20dp"
android:text="我的頻道" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:paddingLeft="10dp"
android:text="長按拖拽替換位置"
android:textSize="15sp" />
<TextView
android:id="@+id/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/redsharp"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="編輯"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#C0C0C0" />
<android.support.v7.widget.RecyclerView
android:id="@+id/mine_recycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#C0C0C0" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:paddingLeft="20dp"
android:text="其他頻道" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:paddingLeft="10dp"
android:text="點擊添加替換我的頻道中"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#C0C0C0" />
<android.support.v7.widget.RecyclerView
android:id="@+id/other_recycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
第二個xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/channel_rl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/sharp"
>
<TextView
android:id="@+id/channel_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="fdsgfdgdfgdfg"
android:textSize="16sp" />
<TextView
android:id="@+id/delete_tv"
android:layout_width="15dp"
android:layout_height="15dp"
android:background="@mipmap/delete" />
</RelativeLayout>
還要添加一個 點擊完成 出現一個圖片在文字上面 點擊可以位置向下移動