首页 文章 精选 留言 我的

精选列表

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

关于ShapeDrawable应用的一些介绍(下)

我们今天接着来看一下Shape中的stroke属性,stroke其实就是边缘的意思,当我们在定义画笔的时候,有很多时候会用到 FILL 和 STROKE,前者能够画出一个实心的形状,而后者就画出一个空心的图形,所以在这里,stroke表示同样的意思,就是描边。 它只有四个属性: 1)Android:width,表示的是线的粗细。 2)android:color,表示的是线的颜色。 3)android:dashGap,表示的是一条虚线,gap表明是虚线中线与线间的的空隙。 4)android:dashWidth,这个属性表示的是虚线中线的长度,只有设置了dashGap来画一条虚线,这个属性值才能起作用。 代码如下: [html] view plain copy <?xmlversion="1.0"encoding="utf-8"?> <shapexmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solidandroid:color="#CCCCCC"/> <strokeandroid:width="1dp"android:color="#FF0000"android:dashWidth="10dp"android:dashGap="2dp"/> </shape> 下面是效果, 最下面的按钮是把形状态变成了line的格式: [html] view plain copy <?xmlversion="1.0"encoding="utf-8"?> <shapexmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <solidandroid:color="#CCCCCC"/> <strokeandroid:width="1dp"android:color="#FF0000"android:dashWidth="10dp"android:dashGap="2dp"/> </shape> 关于stroke的属性其实就这么一点点,没了。 不过我们讲到shape="line“,我们之前做的例子都是rectangle(矩形),oval(椭圆),而line其实就是一条线,可以是虚线,也可以是直线,都是比较简单的。 Android中提供了四种形状,rectangle(矩形),oval(椭圆),line(直线)和 ring(环),前面几种我们其实已经基本说到了,现在就说说最后的ring(环)吧。 先看看xml中的定义,我定义了三个,可以看一下区别: [html] view plain copy <?xmlversion="1.0"encoding="utf-8"?> <shapexmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:useLevel="false"> <gradientandroid:startColor="#FF0000" android:endColor="#00FF00" android:type="linear"/> <strokeandroid:width="1dp"android:color="#0000FF"/> </shape> <!--Ring1--> <shapexmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:innerRadiusRatio="3" android:thicknessRatio="9" android:useLevel="false"> ... </shape> <!--Ring2--> <shapexmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:innerRadiusRatio="2" android:thicknessRatio="2" android:useLevel="false"> ... </shape> <!--Ring3--> <shapexmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:innerRadiusRatio="2" android:innerRadius="30dp" android:thicknessRatio="2" android:useLevel="false"> ... </shape> 如果我们定义的形状是"ring",我们必须把android:useLevel设为false,不然的话,这个环是显示不出来的。 关于Ring还有几个其特有的属性: 1)innerRadius,设置环内圆的半径。 2)innerRadiusRatio,设置的是内圆半径的比例,默认是3,表明是整个环的宽度的1/3,但是如果我们设置了innerRadius,即具体的宽度的话,这个属性是会被覆盖的。 3)thickness,设置环的厚度。 4)thincknessRatio,设置环的厚度的比较,默认是9,表明是整个环的宽度的1/9,但是如果设置了thickness,同样的,这个属性也会被覆盖的。 (我觉得官文文档那里应该是说反了) 下面是上面定义的4个环的效果图: 第一个是默认的,我们只设置了useLevel=false,其它都是默认值,然后第二个就设置其innerradiusratio = 3 和thicknessratio = 9了。 再从左下角的环,可以看出,设置内径和环的厚度的时候,会先设置内径的区域,而环的厚度如果超过了控件的范围,也就不显示了。 关于shape的基础用法基本就是这样,在更多的时候,我们是结合了layer和shape来实现自定义的效果,比如自定义的进度条,在以后的篇章中,再来慢慢说吧。 本文转自农夫山泉别墅博客园博客,原文链接:http://www.cnblogs.com/yaowen/p/5435501.html,如需转载请自行联系原作者

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

如何用Fiddler对Android应用进行抓包

启动Fiddler,打开菜单栏中的 Tools > Fiddler Options,打开“Fiddler Options”对话框。 在Fiddler Options”对话框切换到“Connections”选项卡,然后勾选“Allow romote computers to connect”后面的复选框,然后点击“OK”按钮。 在本机命令行输入:ipconfig,找到本机的ip地址。 打开android设备的“设置”->“WLAN”,找到你要连接的网络,在上面长按,然后选择“修改网络”,弹出网络设置对话框,然后勾选“显示高级选项”。 在“代理”后面的输入框选择“手动”,在“代理服务器主机名”后面的输入框输入电脑的ip地址,在“代理服务器端口”后面的输入框输入8888,然后点击“保存”按钮。 然后启动android设备中的浏览器,访问百度的首页,在fiddler中可以看到完成的请求和响应数据。 本文转自 小强测试帮 51CTO博客,原文链接:http://blog.51cto.com/xqtesting/1750916,如需转载请自行联系原作者

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

Android第三十三期 - Dialog的应用

今天遇到一个大难题哦,不过有大牛一眼就瞄出来了,然后就解决了,AlertDialog和Dialog自定义后圆角的处理,如果你跟我一样没有看到这些细节的话就栽了,用AlertDialog不能使得圆角背景透明化,所以要用Dialog处理才行,也就是下面的方法。 Dialog: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 private static DialogmDialog; //加载gridview中的item的xml方法 public static ViewgetView(Contextcontext, int layoutId){ LayoutInflaterinflater=(LayoutInflater)context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); Viewlayout=inflater.inflate(layoutId, null ); return layout; } /** *显示自定义对话框 * *@paramcontext *@parammessage *@paramlistener */ public static void showDialog( final Contextcontext,Stringmessage, final IAlertDialogButtonListenerlistener){ ViewdialogView= null ; //Dialog.Builderbuilder=newBuilder(context, //R.style.Theme_Transparent); mDialog= new Dialog(context,R.style.Theme_Transparent); dialogView=getView(context,R.layout.dialog_view); Buttonbtn_ok=(Button)dialogView.findViewById(R.id.btn_ok); Buttonbtn_cancel=(Button)dialogView.findViewById(R.id.btn_cancel); TextViewtxt_dailog_message=(TextView)dialogView .findViewById(R.id.txt_dailog_message); txt_dailog_message.setText(message); btn_ok.setOnClickListener( new View.OnClickListener(){ @Override public void onClick(Viewarg0){ //关闭dialog if (mDialog!= null ){ mDialog.cancel(); } //事件回调 if (listener!= null ){ listener.onClick(); } //播放音效 //MyPlayer.playTone(context,MyPlayer.INDEX_STONE_ENTER); } }); btn_cancel.setOnClickListener( new View.OnClickListener(){ @Override public void onClick(Viewarg0){ //关闭dialog if (mDialog!= null ){ mDialog.cancel(); } //播放音效 //MyPlayer.playTone(context,MyPlayer.INDEX_STONE_CANCEL); } }); //为dialog设置View //builder.setView(dialogView); mDialog.setContentView(dialogView); //mDialog=builder.create(); mDialog.show(); } } AlertDialog: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 /** *显示自定义对话框 * *@paramcontext *@parammessage *@paramlistener */ public static void showDialog( final Contextcontext,Stringmessage, final IAlertDialogButtonListenerlistener){ ViewdialogView= null ; AlertDialog.Builderbuilder= new Builder(context, R.style.Theme_Transparent); dialogView=getView(context,R.layout.dialog_view); ImageButtonbtn_ok=(ImageButton)dialogView.findViewById(R.id.btn_ok); ImageButtonbtn_cancel=(ImageButton)dialogView .findViewById(R.id.btn_cancel); TextViewtxt_dailog_message=(TextView)dialogView .findViewById(R.id.txt_dailog_message); txt_dailog_message.setText(message); btn_ok.setOnClickListener( new View.OnClickListener(){ @Override public void onClick(Viewarg0){ //关闭dialog if (mAlertDialog!= null ){ mAlertDialog.cancel(); } //事件回调 if (listener!= null ){ listener.onClick(); } //播放音效 MyPlayer.playTone(context,MyPlayer.INDEX_STONE_ENTER); } }); btn_cancel.setOnClickListener( new View.OnClickListener(){ @Override public void onClick(Viewarg0){ //关闭dialog if (mAlertDialog!= null ){ mAlertDialog.cancel(); } //播放音效 MyPlayer.playTone(context,MyPlayer.INDEX_STONE_CANCEL); } }); //为dialog设置View builder.setView(dialogView); mAlertDialog=builder.create(); mAlertDialog.show(); } af_dialog_background圆角: 1 2 3 4 5 6 7 8 9 10 11 12 <?xmlversion= "1.0" encoding= "utf-8" ?> <shapexmlns:android= "http://schemas.android.com/apk/res/android" > <solidandroid:color= "#3C4856" /> <corners android:bottomLeftRadius= "0.1dp" android:bottomRightRadius= "0.1dp" android:topLeftRadius= "10dp" android:topRightRadius= "10dp" /> </shape> dialog_view: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 <?xmlversion= "1.0" encoding= "utf-8" ?> <LinearLayoutxmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "fill_parent" android:layout_height= "wrap_content" android:gravity= "center_horizontal" android:orientation= "vertical" android:paddingLeft= "10dp" android:paddingRight= "10dp" > <LinearLayout android:layout_width= "match_parent" android:layout_height= "wrap_content" android:background= "@drawable/af_dialog_background" android:orientation= "vertical" > <TextView style= "@style/TextViewStyle_aboutus" android:layout_gravity= "left" android:layout_marginLeft= "10dp" android:layout_marginTop= "5dp" android:text= "@string/af_logo_10_dialog_title" android:textColor= "@color/white4" android:textSize= "14sp" /> <ScrollView android:layout_width= "wrap_content" android:layout_height= "wrap_content" android:layout_marginLeft= "10dp" android:layout_marginRight= "10dp" android:layout_marginTop= "10dp" android:background= "@drawable/af_dialog_background" android:fillViewport= "true" android:scrollbars= "none" > <TextView android:id= "@+id/txt_dailog_message" style= "@style/TextViewStyle_aboutus" android:lineSpacingMultiplier= "1.2" android:text= "@string/af_logo_10_dialog_content" android:textColor= "@color/white4" android:textSize= "14sp" /> </ScrollView> </LinearLayout> <LinearLayout android:layout_width= "match_parent" android:layout_height= "wrap_content" android:background= "@color/white" android:gravity= "center_horizontal" android:orientation= "horizontal" > <Button android:id= "@+id/btn_cancel" style= "?android:attr/buttonBarButtonStyle" android:layout_width= "0dp" android:layout_height= "wrap_content" android:layout_marginBottom= "5dp" android:layout_marginLeft= "25dp" android:layout_marginRight= "15dp" android:layout_marginTop= "5dp" android:layout_weight= "1" android:background= "@drawable/btn_cancelclick" android:contentDescription= "@string/action_settings" android:paddingBottom= "8dp" android:paddingTop= "8dp" android:text= "@string/af_cancel" android:textColor= "@color/white" android:textSize= "16sp" /> <Button android:id= "@+id/btn_ok" style= "?android:attr/buttonBarButtonStyle" android:layout_width= "0dp" android:layout_height= "wrap_content" android:layout_marginBottom= "5dp" android:layout_marginLeft= "15dp" android:layout_marginRight= "25dp" android:layout_marginTop= "5dp" android:layout_weight= "1" android:background= "@drawable/btn_able" android:contentDescription= "@string/action_settings" android:paddingBottom= "8dp" android:paddingTop= "8dp" android:text= "@string/af_confirm" android:textColor= "@color/white" android:textSize= "16sp" /> </LinearLayout> </LinearLayout> 最后是style: 1 2 3 4 5 6 7 8 9 10 <stylename= "Theme_Transparent" parent= "@android:style/Theme.Dialog" > <itemname= "android:windowFrame" > @null </item> <itemname= "android:windowIsFloating" > true </item> <itemname= "android:windowIsTranslucent" > true </item> <itemname= "android:windowNoTitle" > true </item> <itemname= "android:background" > @android :color/transparent</item> <itemname= "android:windowBackground" > @android :color/transparent</item> <itemname= "android:backgroundDimEnabled" > true </item> <itemname= "android:backgroundDimAmount" > 0.6 </item> </style> 谢谢hongyang大神~~开心挣钱每一天 本文转自 吴雨声 51CTO博客,原文链接:http://blog.51cto.com/liangxiao/1613291,如需转载请自行联系原作者

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

查看云服务器应用的虚拟技术

一、获得工具 wgethttp://soft.kwx.gd/tools/virt-what-1.11.tar.gz SSH执行以上命令,下载virt-what。 二、安装 tarzxfvirt-what-1.11.tar.gz#解压缩包cdvirt-what-1.11#进入目录./configure#按默认设置make&&makeinstall#编译并安装 SSH依次执行以上命令安装virt-what 三、查看 virt-what SSH执行以上命令,输出相关虚拟化架构信息(如下图) 测试发现几个云服务用的虚拟技术: xen: 阿里云 kvm: 腾讯云,ucloud,青云 本文转自 zl1030 51CTO博客,原文链接:http://blog.51cto.com/zl1030/1684856

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

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

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册
修改密码
忘记密码