1. 在app的gradle里面(根据情况自选)
compile 'com.github.andyoom:draggrid:v1.0.1'
2.在项目的build.gradle中添加
在两个jcenter下配置
maven {url "https://jitpack.io"}
//做跳转配置Activity
在功能清单中配置ChannelActivity
名字在工程中的External Libraryes中找draggrid-v1.0.1
view文件夹下ChannelActivity 右键该名 Copy Reference
<activityandroid:name="com.andy.library.ChannelActivity"></activity>
MainActivity中写跳转的代码
List<ChannelBean> list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onClick(View v) {
//跳转
list = new ArrayList<>();
ChannelBean channelBean;
for (int i = 0; i < 30; i++) {
if (i < 10) {
channelBean = new ChannelBean("新闻" + i, true);
} else {
channelBean = new ChannelBean("新闻" + i, false);
}
list.add(channelBean);
}
ChannelActivity.startChannelActivity(this,list);
}
3.权限
<!-- 在SDCard中创建与删除文件权限 -->
<uses-permission
android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<!-- 往SDCard写入数据权限 -->
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 震动权限 -->
<uses-permission android:name="android.permission.VIBRATE"/>