![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
安卓
20200316
这个作者很懒,什么都没留下…
展开
-
js keydown在安卓下取不到值得问题
js keydown在安卓下取不到值得问题原创 2022-11-14 16:37:04 · 241 阅读 · 1 评论 -
去掉安卓webview中的点击高亮
css中加入*{-webkit-tap-highlight-color: rgba(0, 0, 0, 0);}*原创 2022-03-21 14:30:32 · 198 阅读 · 0 评论 -
安卓Button设置background无效的问题
主题设置为Theme.MaterialComponents时, 会忽略button的background.解决在res/values/themes.xml 中parent="Theme.MaterialComponents.DayNight.DarkActionBar" 修改为parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge" 这样就可以解决background的问题了, 但是按钮会失去ripple效果使用 <原创 2021-08-05 16:51:13 · 1072 阅读 · 0 评论 -
android网络调试
USB连接手机adb tcpip 5555restarting in TCP mode port:5555拔掉手机adb connect xxx.xxx.xxx.xxx:5555connected to xxx.xxx.xxx.xxx:5555现在可以通过WIFI进行调试了原创 2021-06-29 09:38:21 · 88 阅读 · 0 评论 -
安卓app启动黑屏问题解决
如果app启动时加载时间过长,在显示splash页之前会有一段时间的黑屏,可以通过设置windowBackground显示一张启动图片来解决黑屏的问题styles.xml<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowBackground">@drawable/background</item> <item n原创 2020-05-28 18:29:16 · 1325 阅读 · 0 评论 -
安卓共享元素的使用
页面A和页面B共享一个元素,当从页面A跳转到页面B时,使页面A上的共享元素通过调整大小和位置,直接变换到页面B上页面A上放置一个image,transitionName设置为sharedImage<ImageView android:id="@+id/imageview" android:layout_width="wrap_content" android:layou...原创 2020-03-30 16:45:11 · 183 阅读 · 0 评论 -
webview与js交互
WebView调用JS<html><body> <p></p></body><script> // 前端开发人员可能会把方法写到一个立即执行函数里 (function(){...})(), 防止代码污染, 这样会导致WebView调用js时访问不到js方法 function foo(msg) { docume...原创 2020-03-24 15:55:27 · 145 阅读 · 0 评论 -
Handler Looper MessageQueue
Handler主要用于线程之间的消息通信,发送消息时,消息会进入Handler的消息队列(MessageQueue),之后发送消息的线程会继续执行,Handler所在的线程会通过Looper将消息逐一取出并处理Handler所属的线程必须要有一个Looper去处理消息,系统会自动为主线程创建一个Looper用来处理消息,但是在我们自己创建的子线程中由于没有Looper,会导致调用new Hand...原创 2020-03-20 15:36:38 · 119 阅读 · 0 评论 -
在子线程中使用Handler
在子线程中创建Handler时会抛出RuntimeException异常,提示Can’t create handler inside thread …,这是由于在Handler构造时没有找到当前线程的Looper导致的mLooper = Looper.myLooper();if (mLooper == null) { throw new RuntimeException( ...原创 2020-03-18 16:57:36 · 543 阅读 · 0 评论 -
RecyclerView中的LayoutManager
LinearLayoutManager可以实现垂直或水平的线性布局默认的垂直方向的线性布局LinearLayoutManager layoutManager = new LinearLayoutManager(this);recyclerView.setLayoutManager(layoutManager);水平方向的现行布局// 第三个参数用于指定是否从右到左布局,基本都...原创 2020-03-16 16:18:15 · 310 阅读 · 0 评论 -
RecyclerView的简单使用
添加RecyclerView控件<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" andro...原创 2020-03-16 15:40:40 · 82 阅读 · 0 评论 -
shouldShowRequestPermissionRationale的返回值
应用第一次安装,并且权限被禁用时,返回true权限被禁用时,返回true权限被禁用且不再提示时,返回false已授权时返回falseshouldShowRequestPermissionRationale就是要向用户解释一下你的app为什么需要这个权限。当如果用户已经授权或者用户明确禁止(权限被禁用且不再提示)的时候就不需要再去解释了,所以此时会返回false。...原创 2020-03-16 15:38:46 · 661 阅读 · 1 评论 -
Service
onCreate: 首次创建服务时调用onStartCommand: startService时调用onBind: bindService时调用onUnbind: unbindService时调用onRebind: 重写绑定,并且onUnbind返回true时调用生命周期调用bindService时,根据传入Intent的type判断是否调用onBind,相同的type只执行...原创 2020-03-16 15:33:31 · 96 阅读 · 0 评论 -
Activity生命周期
onCreate:Activity创建时调用onStart:Activity处于可见状态,但还无法交互onResume:此时Activity已经可以进行交互了onPause:Activity处于停止状态onStop:Activity已经不可见了onDestory:Activity正在被销毁Activity生命周期的验证Activity启动:onCreate -> onS...原创 2020-03-16 15:27:38 · 69 阅读 · 0 评论 -
Fragment生命周期
onAttach: Fragment和Activity建立关联时调用onCreateView: Fragment创建视图时调用onActivityCreated: 与Fragment关联的Activity的onCreate返回后调用onDestoryView: Fragment被移除时调用onDetach: Fragment和Activity取消关联时调用Fragment与Acti...原创 2020-03-16 15:29:58 · 107 阅读 · 0 评论