首页 文章 精选 留言 我的

精选列表

搜索[SpringBoot4],共10000篇文章
优秀的个人博客,低调大师

【小功能4】android用SlidingDrawer实现抽拉的滑动效果(也叫抽屉)附源码

今天研究了一个别人写的仿多米音乐的源码,其中有一个功能是抽拉的效果,可以把两个界面的内容显示在一个activity中,利用抽拉实现多内容显示。自己通过摸索参考网上解释实现这一功能,并实现了自己想要的一个功能(为一个程序添加这个功能),接下来上图,没图说个MX。 SlidingDrawer是一个可以实现抽取式显示的控件,可以垂直,水平拉取,每个抽屉都包含两个东西:一个是拉手(handle),一个是抽屉里面的东西(content),SlidingDrawer需要放置在另外的一个layout之上,这意味着SlidingDrawer只能放置在 FrameLayout or a RelativeLayout里面。SlidingDrawer需要设置宽高为match_parent,而且在SlidingDrawer里面必须设置handle与content:。SlidingDrawer隐藏屏外的内容,并允许用户通过handle以显示隐藏内容。它可以垂直或水平滑动,它有俩个View组成,其一是可以拖动的 handle,其二是隐藏内容的View。它里面的控件必须设置布局,在布局文件中必须指定handle和content。 官方文档中的描述是: publicclassSlidingDrawerextendsViewGroupjava.lang.ObjectAndroid.view.Viewandroid.view.ViewGroupandroid.widget.SlidingDrawer 原文:SlidingDrawer hides content out of the screen and allows the user to drag a handle to bring the content on screen.SlidingDrawer can be used vertically or horizontally. A special widget composed of two children views: the handle, that the users drags,and the content, attached to the handle and dragged with it. SlidingDrawer should be used as an overlay inside layouts.This means SlidingDrawer should only be used inside of a FrameLayout or a RelativeLayout for instance.The size of the SlidingDrawer defines how much space the content will occupy once slid out so SlidingDrawer should usually use match_parent for both its dimensions.Inside an XML layout, SlidingDrawer must define the id of the handle and of the content: 主布局配置文件内容:layout/main.xml <?xmlversion="1.0"encoding="utf-8"?> <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background" android:orientation="vertical"> <LinearLayout android:id="@+id/linearLayout" android:layout_width="fill_parent" android:layout_height="80px" android:background="#0000ff" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="该区域大小可通过抽屉控制(马国会)" android:textAppearance="?android:attr/textAppearanceMedium"/> </LinearLayout> <SlidingDrawer android:id="@+id/slidingdrawer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:content="@+id/content" android:handle="@+id/handle" android:orientation="horizontal" > <Button android:id="@+id/handle" android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/handle"/> <ListView android:id="@+id/content" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </SlidingDrawer> </LinearLayout> ListView条目项显示内容布局文件。layout/listview_layout.xml <?xmlversion="1.0"encoding="utf-8"?> <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffff"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/listview_selected" android:padding="6px"> <TextView android:id="@+id/webName" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20px" android:textColor="#000000"/> <TextView android:id="@+id/webDescript" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="16px" android:textColor="#000000"/> </LinearLayout> </LinearLayout> 组件运行时的状态信息配置文件。drable/handle.xml(按钮在按住和正常状态显示不同图片) <?xmlversion="1.0"encoding="utf-8"?> <selectorxmlns:android="http://schemas.android.com/apk/res/android"> <itemandroid:state_window_focused="false"android:drawable="@drawable/handle_normal"/> <itemandroid:state_focused="true"android:drawable="@drawable/handle_focused"/> <itemandroid:state_pressed="true"android:drawable="@drawable/handle_pressed"/> </selector> 组件运行时的状态信息配置文件。drable/listview_selected.xml(listview选项选中效果) <?xmlversion="1.0"encoding="utf-8"?> <selectorxmlns:android="http://schemas.android.com/apk/res/android"> <itemandroid:state_pressed="true" android:drawable="@drawable/list_selector_background_pressed"/> </selector> java类文件,activity代码:com.magh.test.SlidingDrawerTestActivity.java packagecom.magh.test; importandroid.app.Activity; importandroid.os.Bundle; importandroid.view.LayoutInflater; importandroid.view.MotionEvent; importandroid.view.View; importandroid.view.ViewGroup; importandroid.widget.BaseAdapter; importandroid.widget.LinearLayout; importandroid.widget.ListView; importandroid.widget.TextView; /** *@authorMaGuohui *@FileDescription:SlidingDrawer实现伸拉效果案例 *@version2012-12-17下午7:33:06 *@ChangeList: */ publicclassSlidingDrawerTestActivityextendsActivity{ /**Calledwhentheactivityisfirstcreated.*/ privateListViewmyListView; LinearLayoutmLinearLayout; @Override publicvoidonCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); setupViews(); actionProcess(); } privatevoidsetupViews(){ myListView=(ListView)findViewById(R.id.content); myListView.setAdapter(newListViewAdapter()); } privatevoidactionProcess(){//伸拉操作时执行不同事件 android.widget.SlidingDrawermDrawer=(android.widget.SlidingDrawer)findViewById(R.id.slidingdrawer); //mDrawer.open();//设置抽屉为打开状态 mLinearLayout=(LinearLayout)findViewById(R.id.linearLayout);//获取需要控制区域的布局 mDrawer.setOnDrawerOpenListener(newandroid.widget.SlidingDrawer.OnDrawerOpenListener(){ publicvoidonDrawerOpened(){//当抽屉打开时执行此操作 //TODOAuto-generatedmethodstub LinearLayout.LayoutParamslinearParams=(LinearLayout.LayoutParams)mLinearLayout .getLayoutParams(); linearParams.height=40; mLinearLayout.setLayoutParams(linearParams); } }); mDrawer.setOnDrawerCloseListener(newandroid.widget.SlidingDrawer.OnDrawerCloseListener(){ publicvoidonDrawerClosed(){//抽屉关闭时执行此操作 //TODOAuto-generatedmethodstub LinearLayout.LayoutParamslinearParams=(LinearLayout.LayoutParams)mLinearLayout .getLayoutParams(); linearParams.height=80; mLinearLayout.setLayoutParams(linearParams); } }); mDrawer.setOnTouchListener(newView.OnTouchListener(){ @Override publicbooleanonTouch(Viewv,MotionEventevent){ //TODOAuto-generatedmethodstub returnfalse; } }); } privateclassListViewAdapterextendsBaseAdapter{//自定义ListView适配器 //这里返回10行,ListView有多少行取决于getCount()方法 @Override publicintgetCount(){ return8; } @Override publicObjectgetItem(intarg0){ returnnull; } @Override publiclonggetItemId(intarg0){ return0; } @Override publicViewgetView(intposition,Viewv,ViewGroupparent){ finalLayoutInflaterinflater=LayoutInflater .from(getApplicationContext()); if(v==null){ v=inflater.inflate(R.layout.listview_layout,null); } TextViewmyWebName=(TextView)v.findViewById(R.id.webName); TextViewmyWebDescript=(TextView)v .findViewById(R.id.webDescript); myWebName.setText("Android小功能案例"+position); myWebDescript.setText("自己动手,丰衣足食,马国会"+position); returnv; } } } /* *重要属性android:allowSingleTap:指示是否可以通过handle打开或关闭 *android:animateOnClick:指示是否当使用者按下手柄打开/关闭时是否该有一个动画。 * android:content:隐藏的内容 *android:handle:handle(手柄) * *重要方法animateClose():关闭时实现动画 * close():即时关闭getContent():获取内容 *isMoving():指示SlidingDrawer是否在移动 * isOpened():指示SlidingDrawer是否已全部打开 *lock():屏蔽触摸事件setOnDrawerCloseListener(SlidingDrawer.OnDrawerCloseListener *onDrawerCloseListener):SlidingDrawer关闭时调用unlock():解除屏蔽触摸事件 *toggle():切换打开和关闭的抽屉SlidingDrawer */ 附件:http://down.51cto.com/data/2361988 本文转自 646676684 51CTO博客,原文链接:http://blog.51cto.com/2402766/1092350,如需转载请自行联系原作者

优秀的个人博客,低调大师

《WCF技术内幕》翻译4:第1部分_第1章_蓝月亮:商业示例

商业示例所有的这些行业倡议和重大事记都会让你期待一个真实世界的面向服务的应用的例子,WCF可以办到。关于这个问题,我们可以看一下Contoso公司(虚拟的公司)的需求。在我们的例子里,Contoso 是一个世界领先的回飞棒制造商,目前,Contoso的回飞棒订单可以有区域销售代表、或者总部的客户服务中心、或者 Contoso 的网站在线完成。区域办公室,客户服务中心和网站包含各自的订单逻辑。改变订单逻辑需要升级各自的应用系统。图 1-1表示当前应用系统的拓扑结构。 为了例子,我们假设所有的发送订单的应用系统都有它们自己的订购逻辑的实现。如果订购商品的业务流程变化(可能是服从调整),所有的应用系统都必须改变,并且升级必须周密准备。这是非常昂贵和乏味的过程。 在接下来的6个月里,Contoso 希望各地的区域销售代表能够使用它们的手提设备下单。同样,公司高层多年也一直致力于推动合作伙伴使用它们的应用系统下单。在目前的架构 下,每个新的应用系统都需要实现它们自己的订购业务逻辑。对于手提设备来说可行,但是对于商业合作伙伴这样的情况却不太可能。结果,由于升级目前系统和新需求的成本,Contoso小而精干的开发团队已经制定了一个新的、统一的订单处理系统。 一个面向服务的选择对于当前的架构。如图 1-2所示,肩负解决更新和扩展问题的使命。 客观来说,这个例子有点勉强,但是基本原理很清晰。走进任何一个中间件或者大型的IT基础结构,你很可能看到许多类似的业务逻辑嵌套在多个系统中。一个简单的事实就是IT生存期增加了改变业务逻辑的成本,并且成为一个增加新的系统到企业内部的障碍。简单地说,WCF是一个可以让我们设计、构造和管理像图1-2里所示的应用系统,最终能够更好地去响应业务需求。 本文转自 frankxulei 51CTO博客,原文链接:http://blog.51cto.com/frankxulei/318643,如需转载请自行联系原作者

优秀的个人博客,低调大师

4 weekend110的YARN的通用性意义 + yarn的job提交流程

Mr程序写完之后,提交给yarn,yarn会产生一个MRAppMaster,想说的是,yarn变得很 通用,yarn集群上,不光可以跑mr程序,还可以跑各种运算模型。 海量批处理,mapreduce 海量实时处理,spark 海量流式处理,storm Mapreduce实现,MRAppMaster Spark实现,spark AppMaster Storm实现,storm AppMaster 说明,有了hdfs和yarn,什么框架都畅通无阻,运行。 以上是weekend110的YARN的通用性意义 按F5或者open declaration, 下面,来玩玩YarnClientProtocolProvider 因为,上面的断点,只执行到这里,所以这边的也显示到这步。 好的,以上是weekend110的yarn的job提交流程的源码跟踪分析。 Soga,可谓,真的,写源码的人牛逼,我这跟踪源码学习过程,学会到程序的循序渐进,,, 本文转自大数据躺过的坑博客园博客,原文链接:http://www.cnblogs.com/zlslch/p/5895776.html,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册