- 博客(104)
- 资源 (37)
- 收藏
- 关注
原创 android PreferenceManager过时
解决[deprecation] android.preference�е�PreferenceManager�ѹ�ʱ import android.preference.PreferenceManage。
2023-08-22 18:35:28
508
原创 ScrollerCompat过时
[deprecation] androidx.core.widget中的ScrollerCompat已过时import androidx.core.widget.ScrollerCompat;官网给出的答案是:使用OverScroller替换原有的ScrollerCompat
2021-09-07 16:57:31
491
原创 警告: [deprecation] Resources中的getDrawable(int)已过时
getResources().getDrawable(R.drawable.panel_divider)ContextCompat.getDrawable(context,R.mipmap.panel_divider)
2021-07-15 15:12:07
901
原创 警告: [deprecation] Resources中的getColor(int)已过时
getResources().getColor(R.color.color102f74d) ContextCompat.getColor(activity,R.color.color102f74d)
2021-07-15 14:53:51
756
原创 警告: [deprecation] View中的setBackgroundDrawable(Drawable)已过时
view.setBackgroundResource(R.drawable.icon);view.setBackground(ContextCompat.getDrawable(this, R.drawable.icon));
2021-07-15 14:49:45
358
原创 Android和Unity互调
1.工具AndroidStudio: Android Gradle Plugin Version 3.5.2 Gradle Version 5.4.1Unity 3D: 2018.4.30f12.流程 见下图2.1 android 加载unity包2.2 android 点击原生按钮调用unity方法,更新UnityUI/** * // objectName: Unity 对象的名称 * // methodN...
2021-07-02 15:00:21
3496
9
原创 Screen position out of view frustum
Screen position out of view frustum (screen pos 1155.000000, 650.000000, 5000.000000) (Camera rect 0 0 1155 650)
2021-06-16 10:35:38
3768
2
原创 unity 查看运行平台
查看官方地址:https://docs.unity3d.com/Manual/PlatformDependentCompilation.html
2021-06-15 14:35:18
808
5
原创 unity解析json 数据
1.使用JsonUtility解析JsonUtility是unity自带的解析json的工具。具体使用创建一个解释数据的对象类
2021-06-07 10:55:02
6561
原创 Android Activity 伪弹框的基本使用
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.AppCompatDelegateIm...
2021-06-01 18:04:10
3289
4
原创 Unity 报空错
unity 新建一个项目报错如下:尝试过各种解决办法最后修改了 Scripting Runtime Version 的版本号,由.3NET 4X Equivalent 改为了 .NET 3.5 Equvalent(Deprecated).路径:File->BuildSettings->Player Settings->Settings for android ->Scripting Runtime Version...
2021-02-26 13:52:57
1374
2
原创 Unity Launch Error
打开Unity Hub 创建新项目或者打开原有项目失败并弹出如下对话框造成这个的原因我这里是和系统兼容性差造成的,右键“以管理员身份运行”就可以打开或者创建项目。解决办法:右键 兼容性疑难问题解答 就可以可解决,希望可以帮到你。...
2021-02-26 13:41:59
3698
5
原创 LineRenderer的基本使用
LineRenderer是unity3D中的画线工具官方文档:https://docs.unity.cn/cn/current/ScriptReference/LineRenderer.html基本使用前提:新建一个Create Empty Inspector中点击 Add Component 找到 Line Reanderer因为业务原因我是通过代码来控制程序的创建一个脚本并挂载到新建的“Create Empty”中//添加LineRenderer组件...
2021-02-20 17:50:48
8754
原创 unity 3D 实现场景旋转、平移、缩放
前提将脚本挂载到Camera上拖拽的原理 :点击左键记录坐标P1,滑动记录当前坐标P2 计算P1、P2的坐标差dx、dy, 根据dx和dy正负确定移动方向缩放原理:根据滚轮控制摄像机视野和摄像机的正交投影旋转原理:鼠标右键不太好控制,于是指定了键盘 就是直接给旋转赋值完整代码如下:using System.Collections;using Syst...
2021-02-20 17:24:15
3701
原创 Plugin “GsonFormat“ is incompatible
升级androidstudio到4.2版本后突然报错,如下: Plugin Error Plugin "GsonFormat" is incompatible (supported only in IntelliJ IDEA). Plugin "Android Parcelable code generator" is incompatible (supported only in IntelliJ IDEA).原因是现在已经不再支持了,但是我们可以使...
2020-12-15 09:35:25
1489
原创 TextInputLayout的基本使用
TextInputLayout属于EditText的一个浮动标签,属于Material Design 设计规范中的,效果可以看下面的动图账号:只是普通EditText密码:用TextInputLayout包裹的EditText使用的话TextInputLayout包裹一个EditText就可以。当然TextInputLayout也只能包裹EditText:<android.support.design.widget.TextInputLayout android:id=.
2020-12-03 09:11:34
3335
原创 fragment生命周期
fragment的生命周期图片来自:https://developer.android.google.cn/guide/components/fragments通常,至少应实现以下生命周期方法:oncreat():系统会在创建片段时调用此方法。当片段经历暂停或停止状态继而恢复后,如果您希望保留此片段的基本组件,则应在您的实现中将其初始化。onCreatdView():系统会在片段首次绘制其界面时调用此方法。如要为您的片段绘制界面,您从此方法中返回的View必须是片段布局的根视图。如果..
2020-11-30 20:04:55
861
原创 单例模式
package com.wanji.v2x20200806.ui.activity.main;/** * Created by wangjisen on 2020/11/27. */public class Singleton { private static Singleton instance; public Singleton() { } /** * 懒汉式 线程不安全 无法处理多线程 * <p> ...
2020-11-27 15:29:47
117
原创 SurfaceView导致DrawerLayout显示不全
我们在华为的pad算上使用DrawerLayout限制不全,查看发现页面底部使用了SurfaceView,最终的解决办法是:drawerlayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { // TODO Auto-generat...
2020-10-19 10:16:23
458
原创 getResources.getColor过时
在android 23(6.0)及以上getResources.getColor(R.color.colorId)API过时时,那么它的替代方法为ContextCompat.getColor(context,R.color.colorId);可以使用最新的V4兼容包中的ContextCompat,这样也可以兼容低版本的平台...
2020-09-23 16:04:08
588
3
原创 读取Assets目录下的text
读取Assets目录下的text,逐行读取。try { InputStream is = getAssets().open("infoData1.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = br.readLine(); int i = 0; while (line != null) { line = br.readL.
2020-09-17 13:22:35
294
3
原创 ADB常见命令
查看驱动:adb devices查看链接设备的IP:adb shell ifconfig wlan0关闭驱动:adb kill server打开驱动:adb start-server链接驱动:adb connect 192.168.200.170打开某个apk:adb shell am start com.wanji.v2x20200806/.ui.activity.MainActivity adb shell am start 包名/.主...
2020-09-09 20:54:34
599
3
原创 关于MaterialDesign的综合使用
下图是根基前面几篇文章聚合成一个的:Android MaterialDesign简单使用_toolbar:https://blog.youkuaiyun.com/qq_35698774/article/details/107892669Android MaterialDesign简单使用_DrawerLayout:https://blog.youkuaiyun.com/qq_35698774/article/details/107894719悬浮按钮和可交互按钮:https://blog.youkuaiyun.com/qq_356
2020-08-22 18:02:31
264
2
原创 CollapsingToolbarLayout可折叠式标题栏
CollapsingToolbarLayout是一个作用于ToolBar基础上的布局,他说由Design Support库提供的。CollapsingToolbarLayout可以让ToolBar的效果变得更丰富,除了展示标题还有好看的动效。 CollapsingToolbarLayout不能独立存在 AppBarLayout必须是CoordinatorLayout的子布局所以:<?xml version="1.0" encoding="utf-8"?>...
2020-08-22 17:16:36
715
2
原创 SwipeRefreshLayout
SwipeRefreshLayout是用于实现下拉刷新的核心类,使用很简单只需要使用SwipeRefreshLayout将Recyclerview包裹一下就行。使用:xml:<androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/srl" android:layout_width="match_parent" android:layout_height="match_par
2020-08-22 14:34:44
1961
3
原创 CardView的基本使用
CardView是用于实现卡片式布局效果的重要控件,实际上也是一个frameLayout,只是额外提供了圆角和阴影,看上去有立体效果。效果如下:<?xml version="1.0" encoding="utf-8"?><androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:...
2020-08-19 22:30:49
26723
2
原创 悬浮按钮和可交互按钮
2014年Googel I/O大会上重磅推出了一套全新的界面设计语言MaterialDesign。因为设计人员也不了解这个东西,开发人员实现起来也很费劲,几乎没有一个可以用的API,都需要自己实现所以普及程度比较低。 而google也意识到了这一问题,于是2015年的Google I/O大会上推出了一个Design Support库,这个库将一些具有代表性的一些控件和效果进行了封装,这样就大大的简化了实现难度。 立面设计也是MaterialDesign中一...
2020-08-11 21:33:29
1249
2
原创 CMake Warning
CMake Warning at H:/SDK/ndk/16.1.4479499/build/cmake/android.toolchain.cmake:243 (message):armeabi is deprecated and will be removed in a future NDK release.Call Stack (most recent call first):H:/SDK/cmake/3.10.2.4988404/share/cmake-3.10/Modules/CMakeDe
2020-08-10 14:54:58
1072
2
原创 Android MaterialDesign简单使用_DrawerLayout
2014年Googel I/O大会上重磅推出了一套全新的界面设计语言MaterialDesign。因为设计人员也不了解这个东西,开发人员实现起来也很费劲,几乎没有一个可以用的API,都需要自己实现所以普及程度比较低。 而google也意识到了这一问题,于是2015年的Google I/O大会上推出了一个Design Support库,这个库将一些具有代表性的一些控件和效果进行了封装,这样就大大的简化了实现难度。 DrawerLayout是MaterialDesign推...
2020-08-09 17:40:52
645
2
原创 Android MaterialDesign简单使用_toolbar
2014年Googel I/O大会上重磅推出了一套全新的界面设计语言MaterialDesign。因为设计人员也不了解这个东西,开发人员实现起来也很费劲,几乎没有一个可以用的API,都需要自己实现所以普及程度比较低。 而google也意识到了这一问题,于是2015年的Google I/O大会上推出了一个Design Support库,这个库将一些具有代表性的一些控件和效果进行了封装,这样就大大的简化了实现难度。1.DarkActionBar toolb...
2020-08-09 15:20:05
408
2
原创 基于AsyncTask的下载任务
本文章介绍使用AsyncTask异步下载,为了保证任务不被回收,使用service后台服务去执行下载任务,并用通知的方式查看下载进进度。1.下载任务:package com.example.mydownload;import android.os.AsyncTask;import android.os.Environment;import android.util.Log;import java.io.File;import java.io.IOExceptio...
2020-08-01 13:35:28
521
4
原创 Android中Service的生命周期
Service的声明周期相比于activity的声明周期要简单的多。下图就是来自https://developer.android.google.cn/guide/components/services#Lifecycle的图片。我们写一个myservice:package com.example.myservice;import android.app.Service;import android.content.Intent;import android.os.Binder;im
2020-07-27 21:00:59
557
2
原创 Service的简单使用
简介Service是一个服务,android的四大组件之一。他的使用也很简单。建立服务首先我们新建一个Sercve,点击右键New->Service->Service:然后:我们将服务命名为Myservice2,Exported属性表示是否允许除了当前程序之外其他的程序访问这个程序,Enabled表示是否启用这个服务。public class MyService2 extends Service { public MyService2() { }
2020-07-26 17:35:33
3622
2
原创 AsyncTask的简单实用
1.基本描述1.1.AsyncTask是Android提供的轻量级( 实现代码量少) 的异步类。1.2.为了降低异步通信的开发难度,提供了AsyncTask。1.3.AsyncTask直接继承于0bject类,位于android.os包中。1.4.使用AsyncTask可以忽略Looper、MessageQueue、Handler等复杂对象,更便捷的完成异步耗时操作。2.简单使用:2.1.extends AsyncTask<Params, Progress, Result>.
2020-07-16 22:19:36
285
2
原创 android中的线程使用
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6357)
2020-07-15 23:31:25
708
2
原创 解决Listview更新IllegalStateException异常
当我们在使用listview时,数据在跟新的时候频繁滑动容易造成此异常,java.lang.IllegalStateException:。非法状态异常。报以下错误。java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not mo...
2020-07-15 17:43:06
661
2
原创 OkHttp的基本使用
OkHttp是由Square公司开发的。地址:https://github.com/square/okhttp引入项目:dependencies {implementation("com.squareup.okhttp3:okhttp:4.8.0")}获取数据: private void sengRequestWithOkHttp(final String s) { new Thread(new Runnable() { ...
2020-07-12 23:42:17
1529
2
原创 HttpURLConnection
在Android上发送HTTP请求一般有两种一种是HttpURLConnection,另一种是HttpClinet,由于httpClient存在API数量过多,扩展困难等缺点,不建议使用,并且在Android6.0系统中被移除。 以下是介绍HttpURLConnection的使用方法。private void sendRequestWithHttp() { new Thread(new Runnable() { @Overrid...
2020-07-12 23:17:36
330
2
原创 WebView的基本使用
WebView是一android的View类的扩展类,可将网页显示为 Activity 布局的一部分。它不会包含功能全面的网络浏览器的任何功能,例如导航控件或地址栏。WebView默认只显示网页。 基本用法:xml:<?xml version="1.0" encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schem...
2020-07-12 22:58:32
333
2
原创 Android 播放视频
视屏播放主要使用VideoView来实现。他将视屏的显示和控制集一身,使用它可以做一个简单的视频播放器。File file = new File(Environment.getExternalStorageDirectory(), path);videoView.setVideoPath(file.getPath()); // 指定视频文件的路径videoView.start(); // 开始播放videoView.pause(); // 暂停播放videoVi...
2020-06-30 23:48:55
735
3
MyToolBar.zip
2020-08-22
MyCollapsingToolbarLayout.zip
2020-08-22
MySwipeRefreshLayout.zip
2020-08-22
MyCardView.zip
2020-08-19
MyFloatingActionButton.zip
2020-08-11
MyDrawerLayout.zip
2020-08-10
MyToolBar.zip
2020-08-09
MyDownload.zip
2020-08-01
MyBroadcastReceiver1.zip
2020-06-05
MyFragment4.zip
2020-05-31
MyFragment3.zip
2020-05-31
MyFragment2.zip
2020-05-30
MyFragment1.zip
2020-05-30
MyTextview
2018-09-03
Unity2Android_2018_4_30.zip
2021-07-02
unityplugin.zip
2021-07-02
unityplugin.zip
2021-07-02
MyEditTextDemo1.zip
2020-12-03
MyService.zip
2020-07-26
MyAsyncTaskDemo.zip
2020-07-16
MyThred.zip
2020-07-15
MyOkHttpDemo.zip
2020-07-12
MyHttpURLConnection.zip
2020-07-12
MyVoice.zip
2020-06-30
MyAudio.zip
2020-06-30
MyNotification.zip
2020-06-30
MySave4.zip
2020-06-16
MySave3.zip
2020-06-11
MySave2.zip
2020-06-10
MySave1.zip
2020-06-10
MyBroadcastReceiver.zip
2020-06-08
android广播机制(二)
2020-06-05
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人