類似Lollipop的最近運行任的容器:MaterialRecents

jopen 10年前發布 | 8K 次閱讀 Android開發 移動開發 MaterialRecents
一個類似于Lollipop的任務管理器最近打開任務卡片效果的自定義布局。使用CardView實現。

gif


導入

To include in your project, check: https://jitpack.io/#ZieIony/MaterialRecents/d2aec46f48

repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
        compile 'com.github.ZieIony:MaterialRecents:d2aec46f48'
}
用法
    RecentsList recents = (RecentsList) findViewById(R.id.recents);
    recents.setAdapter(new RecentsAdapter() {
    @Override
    public String getTitle(int position) {
        return "Item "+position;
    }

    @Override
    public View getView(int position) {
        ImageView iv  =new ImageView(RecentsActivity.this);
        iv.setImageResource(R.drawable.mazda);
        iv.setBackgroundColor(0xffffffff);
        return iv;
    }

    @Override
    public Drawable getIcon(int position) {
        return getResources().getDrawable(R.mipmap.ic_launcher);
    }

    @Override
    public int getHeaderColor(int position) {
        return colors[random.nextInt(colors.length)];
    }

    @Override
    public int getCount() {
        return 10;
    }

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

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