随笔分类 -  Android

摘要:implementation 'android.arch.lifecycle:extensions:1.1.1' implementation 'android.arch.lifecycle:runtime:1.1.1' 阅读全文
posted @ 2022-02-16 19:56 吴添龙 阅读(126) 评论(0) 推荐(0)
摘要:int sw = DisplayUtils.getScreenWidth(mContext);int h = DisplayUtils.dipToPx(mContext, 40); if (animator == null) { animator = android.animation.ValueA 阅读全文
posted @ 2018-11-01 11:51 吴添龙 阅读(203) 评论(0) 推荐(0)
摘要:public class ContentViewPager extends ViewPager { public ContentViewPager(Context context) { super(context); } public ContentViewPager(Context context 阅读全文
posted @ 2018-07-11 10:48 吴添龙 阅读(496) 评论(0) 推荐(0)
摘要:我门通常用的是十进制,也就是逢十进1,也就是可以用 0,1,2,3,4,5,6,7,8,9表示个位,当到十的时候就进了一位,变成了两位10 同理,八进制是逢八进1,也就是可以用 0,1,2,3,4,5,6,7表示个位,当到八的时候变成了两位10,我们在八进制数10前面加上0,八进制数10就变成了01 阅读全文
posted @ 2018-06-06 17:05 吴添龙 阅读(446) 评论(0) 推荐(0)
摘要:java -jar AutoLayoutPlus.jar width height (注意,输入的时候width在前,height在后;生成的文件夹命名是height在前,width在后) jar包地址: https://github.com/yujiesuperman/autolayoutplus 阅读全文
posted @ 2017-12-25 18:35 吴添龙 阅读(186) 评论(0) 推荐(0)
摘要:开发者只需在App的AndroidManifest.xml文件<application> </application>中添加如下代码: <meta-data android:name="android.max_aspect" android:value="2.1" /> Android 标准接口中, 阅读全文
posted @ 2017-11-30 10:39 吴添龙 阅读(2611) 评论(0) 推荐(0)
摘要:getResources().getDisplayMetrics().densityDpi 就是屏幕密度。getResources().getDisplayMetrics().density 也可以理解为1dip相当于多少个px啦。 dp是虚拟像素,在不同的像素密度的设备上会自动适配,比如: dpi 阅读全文
posted @ 2017-10-17 16:54 吴添龙 阅读(5922) 评论(0) 推荐(0)
摘要:一、资源前缀 (项目中res文件夹下的所有资源都要添加前缀,包括anim、animator、layout、drawable文件夹中的xml文件名,drawable-xhdpi等文件夹下的图片资源名,values文件夹下各文件中的资源名,raw文件夹下的文件资源名。其中attrs文件和styles文件 阅读全文
posted @ 2017-10-07 12:10 吴添龙 阅读(2281) 评论(0) 推荐(0)
摘要:long lastClickTime ;private boolean isFastDoubleClick() { long time = System.currentTimeMillis(); if (time - lastClickTime < 1000) { return true; } la 阅读全文
posted @ 2017-09-15 10:57 吴添龙 阅读(150) 评论(0) 推荐(0)
摘要:如果含有空格 会报 不合法参数异常 正确做法是将其encode 阅读全文
posted @ 2017-09-11 17:09 吴添龙 阅读(940) 评论(0) 推荐(0)
摘要:import android.os.Build;import android.text.TextUtils;import android.webkit.CookieManager;import android.webkit.CookieSyncManager;import java.util.Map 阅读全文
posted @ 2017-09-04 14:19 吴添龙 阅读(203) 评论(0) 推荐(0)
摘要:TV app 焦点控制: http://www.2cto.com/kf/201610/557308.html adb 命令模拟 物理按键 HOME: adb shell input keyevent 3 BACK: adb shell input keyevent 4 系统中 keycode 值 K 阅读全文
posted @ 2017-07-26 17:13 吴添龙 阅读(113) 评论(0) 推荐(0)
摘要:1. 当你点击一个超链接进行跳转时,WebView会自动将当前地址作为Referer(引荐)发给服务器,因此很多服务器端程序通过是否包含referer来控制盗链,所以有些时候,直接输入一个网络地址,可能有问题,那么怎么解决盗链控制问题呢,其实在webview加载时加入一个referer就可以了 pu 阅读全文
posted @ 2017-07-25 18:03 吴添龙 阅读(384) 评论(0) 推荐(0)
摘要:根据官方文档,从Android7.0版本开始 使用URI打开或安装文件需要单独在应用里配置了,问了度娘,有好多版本的结果,个人认为最靠谱的就是下边这个方法,只需在application的oncreate里加上就行了: StrictMode.VmPolicy.Builder builder = new 阅读全文
posted @ 2017-07-06 10:30 吴添龙 阅读(633) 评论(0) 推荐(0)
摘要:String str = "{\"route\":\"onGift\",\"time\":\"\",\"userId\":\"\",\"userName\":\"\",\"level\":\"1_2_2_2_0\",\"adminType\":0,\"tuserId\":\"\"," + "\"tu 阅读全文
posted @ 2017-07-03 11:37 吴添龙 阅读(7762) 评论(0) 推荐(0)
摘要:public class PostTextView extends TextView { private Handler handler = new Handler(Looper.getMainLooper()); public PostTextView(Context context) { sup 阅读全文
posted @ 2017-06-05 11:23 吴添龙 阅读(1525) 评论(0) 推荐(0)
摘要:penaltyDeath(): Crash the whole process on violation. penaltyDeathOnNetwork(): Crash the whole process on any network usage. penaltyDialog(): Show an 阅读全文
posted @ 2017-05-31 16:04 吴添龙 阅读(266) 评论(0) 推荐(0)
摘要:private void setLinearLayoutParams(View imageView) { if (mScreenSize == 0 ) mScreenSize = getScreenSize(); int width = ViewGroup.LayoutParams.MATCH_PA 阅读全文
posted @ 2017-05-25 16:17 吴添龙 阅读(204) 评论(0) 推荐(0)
摘要:/** * 获取屏幕物理尺寸 * @return */private double getScreenSize(){ DisplayMetrics dm = new DisplayMetrics(); ((Activity)getContext()).getWindowManager().getDe 阅读全文
posted @ 2017-05-24 17:35 吴添龙 阅读(225) 评论(0) 推荐(0)
摘要:Compile 默认的依赖方式,任何情况下都会依赖。 Provided 只提供编译时依赖,打包时不会添加进去。 Apk 只在打包Apk包时依赖,这个应该是比较少用到的。 TestCompile 只在测试时依赖 DebugCompile 只在Debug构建时依赖 ReleaseCompile 只在Re 阅读全文
posted @ 2017-05-02 10:31 吴添龙 阅读(311) 评论(0) 推荐(0)