首页 > 其他分享 >StackOverView又一个Android 5.0 任务管理器控件。这次这个比上次那个(MaterialRecents)要流畅些,还可以滑动删除。...

StackOverView又一个Android 5.0 任务管理器控件。这次这个比上次那个(MaterialRecents)要流畅些,还可以滑动删除。...

时间:2023-05-21 22:31:54浏览次数:55  
标签:5.0 控件 管理器 void new Override import android public


StackOverView



下载  收藏



 



Bossyao168 / StackOverView



a custom widget of android,like task manager of android 5.0.



31751



介绍:



又一个Android 5.0 任务管理器控件。这次这个比上次那个(MaterialRecents)要流畅些,还可以滑动删除。



运行效果:





使用说明:


先去看看MaterialRecents的效果 http://www.jcodecraeer.com/a/opensource/2015/0915/3456.html 

 

主布局的xml

<?xml version=             "1.0"              encoding=             "utf-8"             ?>            

             <!-- Copyright (C) 2014 The Android Open Source Project            

                          

                          Licensed under the Apache License, Version 2.0 (the              "License"             );            

                          you may not use              this              file except              in              compliance              with              the License.            

                          You may obtain a copy of the License at            

                          

                          http:             //www.apache.org/licenses/LICENSE-2.0            

                          

                          Unless required by applicable law or agreed to              in              writing, software            

                          distributed under the License is distributed on an              "AS IS"              BASIS,            

                          WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.            

                          See the License              for              the specific language governing permissions and            

                          limitations under the License.            

             -->            

             <FrameLayout            

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

                          android:layout_width=             "match_parent"             

                          android:layout_height=             "match_parent"            

                          android:paddingTop=             "32dp"             >            

                          

                          <!-- Recents View -->            

                          <com.wirelesspienetwork.overview.views.Overview            

                          android:id=             "@+id/recents_view"            

                          android:layout_width=             "match_parent"             

                          android:layout_height=             "match_parent"            

                          android:focusable=             "true"              />            

                          

             </FrameLayout>


item的xml

<?xml version=             "1.0"              encoding=             "utf-8"             ?>            

             <!-- Copyright (C) 2014 The Android Open Source Project            

                          

                          Licensed under the Apache License, Version 2.0 (the              "License"             );            

                          you may not use              this              file except              in              compliance              with              the License.            

                          You may obtain a copy of the License at            

                          

                          http:             //www.apache.org/licenses/LICENSE-2.0            

                          

                          Unless required by applicable law or agreed to              in              writing, software            

                          distributed under the License is distributed on an              "AS IS"              BASIS,            

                          WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.            

                          See the License              for              the specific language governing permissions and            

                          limitations under the License.            

             -->            

             <LinearLayout            

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

                          android:layout_width=             "match_parent"            

                          android:layout_height=             "wrap_content"            

                          android:focusable=             "true"            

                          android:layout_gravity=             "center_horizontal|top"             >            

                          

                          <LinearLayout            

                          android:layout_width=             "wrap_content"            

                          android:layout_height=             "1000dp"            

                          android:orientation=             "vertical"            

                          android:layout_gravity=             "center_horizontal|top"            

                          >            

                          

                          <Button            

                          android:layout_width=             "wrap_content"            

                          android:layout_height=             "wrap_content"            

                          android:text=             "testButton"             />            

                          

                          

                          </LinearLayout>            

             </LinearLayout>


activity

/*            

                          * Copyright (C) 2014 The Android Open Source Project            

                          *            

                          * Licensed under the Apache License, Version 2.0 (the "License");            

                          * you may not use this file except in compliance with the License.            

                          * You may obtain a copy of the License at            

                          *            

                          *      http://www.apache.org/licenses/LICENSE-2.0            

                          *            

                          * Unless required by applicable law or agreed to in writing, software            

                          * distributed under the License is distributed on an "AS IS" BASIS,            

                          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.            

                          * See the License for the specific language governing permissions and            

                          * limitations under the License.            

                          */            

                          

             package com.wirelesspienetwork.overviewexample;            

                          

             import android.app.Activity;            

             import android.app.SearchManager;            

             import android.content.Context;            

             import android.content.Intent;            

             import android.content.IntentFilter;            

             import android.graphics.Color;            

             import android.os.Bundle;            

             import android.os.Handler;            

             import android.view.View;            

             import android.view.ViewGroup;            

                          

             import com.wirelesspienetwork.overview.misc.Utilities;            

             import com.wirelesspienetwork.overview.model.OverviewAdapter;            

             import com.wirelesspienetwork.overview.model.ViewHolder;            

             import com.wirelesspienetwork.overview.views.Overview;            

                          

             import java.lang.reflect.InvocationTargetException;            

             import java.util.ArrayList;            

             import java.util.Random;            

                          

             /**            

                          * The main Recents activity that is started from AlternateRecentsComponent.            

                          */            

             public class OverviewActivity extends Activity implements Overview.RecentsViewCallbacks            

             {            

                          boolean mVisible;            

                          // Top level views            

                          Overview mRecentsView;            

                          

                          /** Called with the activity is first created. */            

                          @Override            

                          public void onCreate(Bundle savedInstanceState) {            

                          super             .onCreate(savedInstanceState);            

                          // For the non-primary user, ensure that the SystemSericesProxy is initialized            

                          

                          // Initialize the widget host (the host id is static and does not change)            

                          

                          // Set the Recents layout            

                          setContentView(R.layout.recents);            

                          mRecentsView = (Overview) findViewById(R.id.recents_view);            

                          mRecentsView.setCallbacks(             this             );            

                          mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |            

                          View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |            

                          View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);            

                          

                          // Register the broadcast receiver to handle messages when the screen is turned off            

                          IntentFilter filter =              new              IntentFilter();            

                          filter.addAction(Intent.ACTION_SCREEN_OFF);            

                          filter.addAction(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED);            

                          

                          // Private API calls to make the shadows look better            

                          try              {            

                          Utilities.setShadowProperty(             "ambientRatio"             , String.valueOf(1.5f));            

                          }              catch              (IllegalAccessException e) {            

                          e.printStackTrace();            

                          }              catch              (InvocationTargetException e) {            

                          e.printStackTrace();            

                          }            

                          }            

                          

                          @Override            

                          protected void onNewIntent(Intent intent) {            

                          super             .onNewIntent(intent);            

                          setIntent(intent);            

                          }            

                          

                          @Override            

                          protected void onStart() {            

                          super             .onStart();            

                          }            

                          

                          @Override            

                          protected void onResume() {            

                          super             .onResume();            

                          

                          // Mark Recents as visible            

                          mVisible =              true             ;            

                          

                          ArrayList<Integer> models =              new              ArrayList<>();            

                          for             (int i = 0; i < 10; ++i)            

                          {            

                          Random random =              new              Random();            

                          random.setSeed(i);            

                          int color = Color.argb(255, random.nextInt(255), random.nextInt(255), random.nextInt(255));            

                          models.add(color);            

                          }            

                          

                          final OverviewAdapter stack =              new              OverviewAdapter<ViewHolder<View, Integer>, Integer>(models)            

                          {            

                          @Override            

                          public ViewHolder onCreateViewHolder(Context context, ViewGroup parent) {            

                          View v = View.inflate(context, R.layout.recents_dummy,              null             );            

                          return              new              ViewHolder<View, Integer>(v);            

                          }            

                          

                          @Override            

                          public void onBindViewHolder(ViewHolder<View, Integer> viewHolder) {            

                          viewHolder.itemView.setBackgroundColor(viewHolder.model);            

                          }            

                          };            

                          

                          mRecentsView.setTaskStack(stack);            

                          

             //        new Handler().postDelayed(new Runnable() {            

             //            @Override            

             //            public void run() {            

             //                stack.notifyDataSetInserted(new Integer(1), 2);            

             //            }            

             //        },2000);            

                          

                          

                          }            

                          

                          @Override            

                          protected void onStop() {            

                          super             .onStop();            

                          }            

                          

                          @Override            

                          protected void onDestroy() {            

                          super             .onDestroy();            

                          }            

                          

                          @Override            

                          public void onTrimMemory(int level) {            

                          }            

                          

                          @Override            

                          public void onAllCardsDismissed() {            

                          }            

                          

                          @Override            

                          public void onCardDismissed(int position) {            

                          

                          }            

             }


 

标签:5.0,控件,管理器,void,new,Override,import,android,public
From: https://blog.51cto.com/u_16112859/6320404

相关文章

  • 【记录一下】修正lazarus fr报表控件在龙芯电脑不能使用QRcode的Bug
    近日海南朋友使用fr控件时发现不能在报表插入QRCode和PDF417等二维码,经跟踪发现只需将frxBarcodePDF417.pas第1592行将A:=TInt(ERROR_LEVEL[errorLevel]);改为:A:=@(ERROR_LEVEL[errorLevel]);就可以正常插入QRCode等二维码了,如果你使用过程也遇到同样问题可参考一下......
  • 袋鼠云数栈UI5.0焕新升级,全新设计语言DT Design,更懂视觉更懂你!
    数栈作为袋鼠云打造的一站式数据开发与治理平台,从2016年发布第⼀个版本开始,就始终坚持着以技术为核⼼、安全为底线、提效为⽬标、中台为战略的思想,坚定不移地⾛国产化信创路线,不断推进产品功能迭代、技术创新、服务细化和性能升级。伴随业务的⻜速发展,数栈设计团队也启动了针对数栈......
  • RocketMQ 5.0 如何配置TLS加密传输?
    本文作者:李伟,社区里大家叫小伟,ApacheRocketMQCommitter,RocketMQPython客户端项目Owner,ApacheDorisContributor,腾讯云RocketMQ开发工程师。01传输架构图Namesrv:5.1.0Broker:5.1.0Dashboard:1.0.1-SNAPSHOT02准备Namesrv、Broker、Client的ca证书、密钥以下全部操作在......
  • 报表控件FastReport VCL v2023.2 - 将Delphi 产品整合到单一系统
    FastReport 是功能齐全的报表控件,可以帮助开发者可以快速并高效地为.NET,VCL,COM,ActiveX应用程序添加报表支持,由于其独特的编程原则,现在已经成为了Delphi平台最优秀的报表控件,支持将编程开发中的报表信息输出为TXT、PDF等多种文件格式,是编程开发人员必备的报表工具。FastReportVC......
  • 界面控件DevExpress Blazor UI v22.2 - 报表、富文本编辑器组件增强
    DevExpress拥有.NET开发需要的所有平台控件,包含600多个UI控件、报表平台、DevExpressDashboardeXpressApp框架、适用于VisualStudio的CodeRush等一系列辅助工具,该组件拥有众多新产品和数十个具有高影响力的功能,可为桌面、Web和移动应用提供直观的解决方案,全面解决各种使用场......
  • 第3章 数据库操作-通过DataGridView控件进行数据库的操作
    通过DataGridView控件进行数据库的操作usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;usingS......
  • 现已可用Windows 10 Hyper-V管理器轻松安装Ubuntu
    微软一直在努力确保开发人员拥有所需的所有工具,WindowsSubsystemforLinux就被用来帮助他们安装不同版本的Linux。现在公司已经做出了另一项改变,可以协助开发人员快速安装Ubuntu,这是最流行的基于Linux的操作系统之一Windows10用户可以使用Hyper-V管理器在其Windows10设备上轻松......
  • ProgressBar 进度控件
    在VB.NET中,你可以使用ProgressBar控件或者自定义的进度提示方法来实现这个功能。以下是一个示例代码,展示如何使用ProgressBar控件来显示导入情况:'创建一个ProgressBar控件DimprogressBarAsNewProgressBar()progressBar.Minimum=0progressBar.Maximum=totalC......
  • 界面控件DevExtreme使用指南 - 如何为雷达图添加注释?
    在之前的版本中,官方技术团队为DevExtreme图表引入了注释支持。在v20.1版本中,继续扩展了对PolarChart(雷达图)注释的支持,现在可以根据需要应用文本、图像或自定义注释。创建注释后,可以将其附加到PolarChart(雷达图)元素(例如一个序列点)或在特定坐标上显示它。DevExtreme拥有高性能......
  • Android 控件之Notification
    [quote]最近一直在研究android,并一边研究一边做应用。其中遇到了把程序通知常驻在Notification栏,并且不能被clear掉的问题。虽然notify()的第一个参数可以写死并clear掉,但这个值我并不想写死,但是这个值如果是随机生成一个数怎么传给Activity,用Intent当中的Bu......