首页 文章 精选 留言 我的

精选列表

搜索[人设自定义],共10006篇文章
优秀的个人博客,低调大师

android中checkbox自定义样式

1、首先res/drawable中定义编写如下样式: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/check_true" android:state_checked="true"></item> <item android:drawable="@drawable/check_true" android:state_selected="true"></item> <item android:drawable="@drawable/check_true" android:state_pressed="true"></item> <item android:drawable="@drawable/check_false"></item> </selector> 2、在layout中添加checkbox控件: <CheckBox android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/btn_check" android:button="@null" android:checked="true"/> 其中drwable/btn_check为1中顶一个文件名称,另外必须将android:button设置为@null。 @drawable/check_true和@drawable/check_false为checkbox不同状态的图片,可自行设计。 本文转自 netcorner 博客园博客,原文链接:http://www.cnblogs.com/netcorner/p/4887103.html ,如需转载请自行联系原作者

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

android自定义访问权限permission

由于Android部分设计原理较为开放,可能通过Intent或PackageManager就可以解析处理调用其他应用的子类,所以在部分应用中需要做更多的安全处理,保证应用内部的稳定性和安全性。 稳定性: 部分类可能没有数值的传入将会导致可能初始化失败,造成Force Close等问题。 安全性: 其他应用调用本程序的SQL数据库等问题,可能会造成一些无法预料到的损失。 一、Android应用内部安全保护 为了考虑内部部分敏感数据处理的安全性加入类ACL访问控制,当然使用了更加灵活的,比如UID、SID、PID等多种方式。 1. 部分私有的配置信息,或相对轻量级的内容,可以使用SharedPreferences接口提供的相关方法处理,并设置为安全标志位私有MODE_PRIVATE,不过需要注意的是该方法仅能本进程调用。 2. SQLite的安全问题,对于Content Provider的处理权限,在Android中可以直接显示的声明,比如在androidmanifest.xml中声明读或写权限,在Provider节点中,声明android:writePermission或android:readPermission属性,当然其他程序声明了这些权限也可以访问,这时我们可以通过 android:authorities属性限制一个类的访问,比如android:authorities="cn.com.android.cwj" 。最终类似 <provider android:name="cwjProvider" android:authorities="cn.com.android.cwj" android:writePermission="cn.com.android.cwj.permission.WRITE_DATABASE" android:readPermission="cn.com.android.cwj.permission.READ_DATABASE" /> 数据库本身的读写可以处理多线程问题,但是数据的先后可以考虑同步问题,设置android:multiprocess="true"属性来保证数据的正确性,相关问题不在本文讨论范围内,我们可能会在以后的内容中涉及这部分问题。 3. Activity、Service和Receiver的权限声明方式,可以直接使用android:permission属性,具体的和上面的SQLite安全一样的处理方式,演示代码如下 <activity android:name=".cwj" android:authorities="cn.com.android" android:permission="cn.com.android.cwj.permission.ACCESS"/> 二、Permission的声明 <permission android:name="cn.com.android.cwj.permission.ACCESS" android:protectionLevel="normal" android:label="@string/permission_aceess" android:description="@string/permission_aceess_detail" /> 当然还有可选的属性比如说android:protectionLevel="normal"设置保护权限,还有必须签名signature,当然这里对于权限分组我们可以通过类似permission的方法来声明permissionGroup,或直接使用系统的,比如android:permissionGroup="android.permission-group.SYSTEM_TOOLS"最终其他应用中调用,可以显示的在自己的manifest.xml中声明即可,类似 <uses-permission android:name="cn.com.android.cwj.permission.ACCESS" /> 三、账户安全声明 直接在androidmanifest.xml中的Application中直接声明,比如标准用户权限类似 android:sharedUserId="android.uid.shared" ,当然处理一些RIL方面的可以声明类似 android.uid.phone 的权限,处理一些更敏感的数据。 四、Service安全 对于Service而言除了限制访问的package外,我们还可以通过直接绑定并参数判断的访问来处理尽量不使用android:exported="true"的导出方法,当然通过broadcast方式通讯可以通过intent的extra方式可以做一些简单的验证。 五、PID的安全问题 PID的安全问题,通过限制processID的方式限制访问,仅允许在同一个进程空间访问。 六、android permissionLevel 在permissionLevel的定义时设置了android:protectionLevel这一项。取值范围有四种: "normal" "dangerous" "signature" "signatureOrSystem" 如果定义的是前面两种normal或者dangerous, 我们自己的应用需要去访问其对应受保护的资源时只需要在androidManifest.xml中添加相同的uses-permission就行了。 如果是signature, 我们仅仅添加对权限的使用还不行, 必须同时具有相同的签名。 如果是signatureOrSystem, 不仅要有相同的签名, 还必须有相同的sharedUserId. 本文转自xyz_lmn51CTO博客,原文链接:http://blog.51cto.com/xyzlmn/816809,如需转载请自行联系原作者

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

Android自定义属性,format详解

1. reference:参考某一资源ID。 (1)属性定义: <declare-styleable name = "名称"> <attr name = "background" format = "reference" /> </declare-styleable> (2)属性使用: <ImageView android:layout_width = "42dip" android:layout_height = "42dip" android:background= "@drawable/图片ID" /> 2. color:颜色值。 (1)属性定义: <declare-styleable name = "名称"> <attr name = "textColor" format = "color" /> </declare-styleable> (2)属性使用: <TextView android:layout_width = "42dip" android:layout_height = "42dip" android:textColor= "#00FF00" /> 3. boolean:布尔值。 (1)属性定义: <declare-styleable name = "名称"> <attr name = "focusable" format = "boolean" /> </declare-styleable> (2)属性使用: <Button android:layout_width = "42dip" android:layout_height = "42dip" android:focusable= "true" /> 4. dimension:尺寸值。 (1)属性定义: <declare-styleable name = "名称"> <attr name = "layout_width" format = "dimension" /> </declare-styleable> (2)属性使用: <Button android:layout_width= "42dip" android:layout_height= "42dip" /> 5. float:浮点值。 (1)属性定义: <declare-styleable name = "AlphaAnimation"> <attr name = "fromAlpha" format = "float" /> <attr name = "toAlpha" format = "float" /> </declare-styleable> (2)属性使用: <alpha android:fromAlpha= "1.0" android:toAlpha= "0.7" /> 6. integer:整型值。 (1)属性定义: <declare-styleable name = "AnimatedRotateDrawable"> <attr name = "visible" /> <attr name = "frameDuration" format="integer" /> <attr name = "framesCount" format="integer" /> <attr name = "pivotX" /> <attr name = "pivotY" /> <attr name = "drawable" /> </declare-styleable> (2)属性使用: <animated-rotate xmlns:android = "http://schemas.android.com/apk/res/android" android:drawable = "@drawable/图片ID" android:pivotX = "50%" android:pivotY = "50%" android:framesCount= "12" android:frameDuration= "100" /> 7. string:字符串。 (1)属性定义: <declare-styleable name = "MapView"> <attr name = "apiKey" format = "string" /> </declare-styleable> (2)属性使用: <com.google.android.maps.MapView android:layout_width = "fill_parent" android:layout_height = "fill_parent" android:apiKey= "0jOkQ80oD1JL9C6HAja99uGXCRiS2CGjKO_bc_g" /> 8. fraction:百分数。 (1)属性定义: <declare-styleable name="RotateDrawable"> <attr name = "visible" /> <attr name = "fromDegrees" format = "float" /> <attr name = "toDegrees" format = "float" /> <attr name = "pivotX" format = "fraction" /> <attr name = "pivotY" format = "fraction" /> <attr name = "drawable" /> </declare-styleable> (2)属性使用: <rotate xmlns:android = "http://schemas.android.com/apk/res/android" android:interpolator = "@anim/动画ID" android:fromDegrees = "0" android:toDegrees = "360" android:pivotX= "200%" android:pivotY= "300%" android:duration = "5000" android:repeatMode = "restart" android:repeatCount = "infinite" /> 9. enum:枚举值。 (1)属性定义: <declare-styleable name="名称"> <attr name="orientation"> <enumname="horizontal" value="0" /> <enumname="vertical" value="1" /> </attr> </declare-styleable> (2)属性使用: <LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:orientation= "vertical" android:layout_width = "fill_parent" android:layout_height = "fill_parent" > </LinearLayout> 10. flag:位或运算。 (1)属性定义: <declare-styleable name="名称"> <attr name="windowSoftInputMode"> <flagname = "stateUnspecified" value = "0" /> <flagname = "stateUnchanged" value = "1" /> <flagname = "stateHidden" value = "2" /> <flagname ="stateAlwaysHidden" value = "3" /> <flagname = "stateVisible" value = "4" /> <flagname = "stateAlwaysVisible" value = "5" /> <flagname = "adjustUnspecified" value = "0x00" /> <flagname = "adjustResize" value = "0x10" /> <flagname = "adjustPan" value = "0x20" /> <flagname = "adjustNothing" value = "0x30" /> </attr> </declare-styleable> (2)属性使用: <activity android:name = ".StyleAndThemeActivity" android:label = "@string/app_name" android:windowSoftInputMode= "stateUnspecified | stateUnchanged | stateHidden"> <intent-filter> <action android:name = "android.intent.action.MAIN" /> <category android:name = "android.intent.category.LAUNCHER" /> </intent-filter> </activity> 注意: 属性定义时可以指定多种类型值。 (1)属性定义: <declare-styleable name = "名称"> <attr name = "background" format = "reference|color" /> </declare-styleable> (2)属性使用: <ImageView android:layout_width = "42dip" android:layout_height = "42dip" android:background= "@drawable/图片ID|#00FF00" /> 本文转自天天_byconan博客园博客,原文链接:http://www.cnblogs.com/tiantianbyconan/archive/2012/06/06/2538528.html ,如需转载请自行联系原作者

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

Android自定义雷达扫描控件

转载请说明出处! 作者:kqw攻城狮 出处:个人站 | CSDN Android 雷达扫描控件 To get a Git project into your build: Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories: allprojects { repositories { ... maven { url 'https://jitpack.io' } } } Step 2. Add the dependency dependencies { compile 'com.github.kongqw:AndroidRadarScanView:1.0.1' } 源码:AndroidRadarScanView 效果图 XML <com.kongqw.radarscanviewlibrary.RadarScanView android:id="@+id/radarScanView" android:layout_width="match_parent" android:layout_height="match_parent" /> 初始化 radarScanView = (RadarScanView) findViewById(R.id.radarScanView); 设置属性 XML xmlns:app="http://schemas.android.com/apk/res-auto" <com.kongqw.radarscanviewlibrary.RadarScanView android:id="@+id/radarScanView" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" app:radarBackgroundColor="@color/colorAccent" app:radarBackgroundLinesColor="@color/colorPrimaryDark" app:radarBackgroundLinesNumber="3" app:radarBackgroundLinesWidth="5.5" app:radarScanAlpha="0x33" app:radarScanColor="#FF000000" app:radarScanTime="5000" /> 属性 类型 描述 radarScanTime integer 设置雷达扫描一圈时间 radarBackgroundLinesNumber integer 设置雷达背景圆圈数量 radarBackgroundLinesWidth float 设置雷达背景圆圈宽度 radarBackgroundLinesColor color 设置雷达背景圆圈颜色 radarBackgroundColor color 设置雷达背景颜色 radarScanColor color 设置雷达扫描颜色 radarScanAlpha integer 设置雷达扫描透明度 Java radarScanView // 设置雷达扫描一圈时间 .setRadarScanTime(2000) // 设置雷达背景颜色 .setRadarBackgroundColor(Color.WHITE) // 设置雷达背景圆圈数量 .setRadarBackgroundLinesNumber(4) // 设置雷达背景圆圈宽度 .setRadarBackgroundLinesWidth(2) // 设置雷达背景圆圈颜色 .setRadarBackgroundLinesColor(Color.GRAY) // 设置雷达扫描颜色 .setRadarScanColor(0xFFAAAAAA) // 设置雷达扫描透明度 .setRadarScanAlpha(0xAA); 备用 手动开始扫描 radarScanView.startScan(); 手动停止扫描 radarScanView.stopScan();

资源下载

更多资源
Mario

Mario

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

Nacos

Nacos

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

Rocky Linux

Rocky Linux

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

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册