综述 这是自己总结的开发技巧,不断更新中··········· 编写技巧 1. text文本单行显示并设置省略号 将TextView控件的singleLine属性设为True,并将ellipsize设为...end android:singleLine="true" android:ellipsize="end" 效果如下: 只在一行显示,如果文本多余,末尾会出现三个点,三个点的样式也是可以改变的...把ellipsize值有middle,start,end,marque,none 2.imageView图片框四周白边去除 android:adjustViewBounds="true" android...来改变颜色 4、返回父activity页面从左到右滑 在父activity设置属性: android:launchMode="singleTop" 5、修复按钮设置背景没反应的问题 <style name...; h+=view.getMeasuredHeight(); } listView.getLayoutParams().height=h; 7、设置复选框按钮的颜色 xml中设置 android
Kotlin作为Android开发第一语言,然而身边做Android的大多还是使用java。...Android转到Kotlin的趋势是必然的,公司隔壁部门已经全部使用Kotlin开发,我们在以后新的项目里,也会以Kotlin为主。...关于Kotlin的知识,博主只是在去年下半年的时候看过官网的教程,也读了《Kotlin for Android Developers》,并写了一个练手项目,不过大半年过去了,要把以前学过的知识重新拿起来有点儿不易...,于是总结了一些Kotlin在Android开发中的常用技巧。...Kotlin 基础技巧 单例 Kotlin是一种非常简单的语言,单例也是如此,这里列出两种常用的单例格式: 第一种:通过伴生对象+委托实现单例 class App : MultiDexApplication
Rouse 读完需要 6 分钟 速读仅需 2 分钟 Android 应用开发中,执行后台任务是常见需求之一。...引言 在移动应用开发中,经常需要在后台执行一些耗时任务,如下载文件、处理数据等。IntentService 是 Android 中的一个服务,专门用于简化这类任务的处理。...线程管理 工作线程的创建和管理由 IntentService 自动处理,开发者无需担心多线程相关的细节。...高版本替代品 在Android8.0及以后IntentService不再推荐使用,高版本推荐使用WorkManager。 总结 IntentService简化了后台任务的执行,提高了开发效率。...其自动管理生命周期和线程,使得开发者能够更专注于业务逻辑的实现。通过本文的深入解析,相信读者能够更全面地了解并合理使用 IntentService。 点个在看你最好看
/storage/emulated/0/… 手机内部存储路径 mEditText.setKeyListener(null); EditText设置不可编辑,比focusable、enable更粗暴 android...android:attr/selectableItemBackground" item的水波纹效果,在item的View加上这一属性, 5.0+才行 includeFontPadding=“false”...android:weightSum=“3” 设置LinearLayout中的权重总数 android:fillViewport=“true” ScrollView设置全屏 SystemClock.sleep...android:includeFontPadding=“false” 去掉TextView内部padding 快捷键 提高开发效率 live template动态模板 提高开发效率 Android快速开发整理...(库、插件、常用网站) 提高开发效率 Github Android-Develop-Tips 欢迎补充
startActivityForResult(Intent intent, Int requestCode) intent 传给B的,不解释,看不懂你还是玩玩手机算了,别想开发的事情了 requestCode... xmlns:Android=”http://schemas.android.com/apk/res/android” Android:background=”@drawable/top...” Android:layout_height=”wrap_content” Android:layout_marginRight=”10px” Android...11、在布局中使用scrollview: 把原来的布局用android=”http://schemas.android.com/apk/res/android” ...android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:scrollbars=”none
3.Android TextView字体设置 ?...android:layout_height="wrap_content" android:scaleType="fitXY" android:adjustViewBounds="true" android...7.Android设置EditText默认取消焦点 在EditText的父控件中,添加两个属性即可, 如下, android:focusable="true" android:focusableInTouchMode...android:layout_width="match_parent" android:layout_height="80dp" android:gravity="top..." android:imeOptions="actionDone" android:inputType="text" android:padding="4dp
封装类实现FileUtils类,代码遵循单例模式 import android.content.Context; import android.os.Environment; import android.os.Handler...> android="http://schemas.android.com/apk/res/android" android:layout_width=..."match_parent" android:layout_height="match_parent" android:orientation="vertical" android...imm.hideSoftInputFromWindow(view.getWindowToken(), 0); //强制隐藏 } } 6.EditText输入文本从右边开始显示 在进行计算器等开发的时候...代码: import android.content.Context; import android.os.Environment; import android.os.Handler; import
前言 Android的夜间模式主要主用于阅读方面,在QQ,微信读书,新闻阅读类一般会有相应的功能,本文主要介绍整体APP的夜间模式以及webview中夜间模式的实现。 效果图展示 ? ?...android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns...:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolBar" android:layout_width="...match_parent" android:layout_height="?...attr/actionBarSize" android:background="@color/colorPrimary" android:fitsSystemWindows="true"
同样,还有另外一个属性也很神奇:android:clipChildren,具体请参考:【Android】神奇的android:clipChildren属性(http://www.cnblogs.com/...如果嵌套的View过于复杂,解决方案可以是通过代码测量列表所需要的高度,或者在getView中使用一个小技巧:parent.getChildCount == position @Override public...Android NestedScrolling 实战 (http://www.race604.com/android-nested-scrolling/) 7、EmojiconTextView的setText...服务端的代码由PHP实现,有时开发为了修改方便,直接用windows记事本打开保存,引入了人眼看不到的问题。其实就是多了”ufeff”这个玩意,客户端代码过滤一下就行了。...参考: android:clipToPadding和android:clipChildren http://www.alloyteam.com/2014/10/androidcliptopadding-he-androidclipchildren
现在的Android应用越来越庞大,开发者越来越能感受到方法数限制带来的影响。这里简单讲几个减少方法数的小建议。 1.什么是方法数?为什么它这么重要? ...很遗憾,Android在刚开始被设计的时候,这一区域的方法数量不能超过65536个,也就是2个字节表示的范围。当源码定义或引用的方法数量超过了这个限制的话,就会导致编译不成功,你说重要不重要呢? ...package*/staticvoidFoo.access$200(Foo foo,int value){ foo.doStuff(value); } 具体可以参考:http://developer.android.com
Android 系统是基于 Linux 的,因此很多地方是相同的,比如编译。...Linux 中管理编译的文件是 Makefile,Android 系统管理编译的文件是 Android.mk,他们的语法相似,都会定义编译目标,声明依赖关系。...Android 模块编译 由于Android 全编耗时太久,大部分情况下,如果你只修改几个文件,可以模块编译。...命令如下: m:编译整个安卓系统 mm:编译当前目录下的模块,当前目录下需要有 Android.mk,否则就往上找最近的Android.mk文件。...其实Android 就是把 rootfs 替换了,变成了 Android 文件系统,uboot 和 Linux Kernel 还是差不多的。 启动流程也是差不多的(从下往上看)
一.Eclipse配置使用 1.显示行号(Winodw-->Preferences-->General-->Editors-->Text Editors-->勾...
作者:AWeiLoveAndroid 博客:https://www.jianshu.com/p/b74107b6464d 在平时Android开发中,可能会出现某个类有很多个重载方法。...【优点】暂时解决了方法维护的问题,开发人员不再为过时方法维护了,而且旧版本也可以使用相应方法,对老版本兼容性比较好。 【缺点】所有的方法都在,还是有那么多冗余代码,还是没从根源上解决问题。
在本文中,我们将探讨Kotlin扩展函数的原理和运用,以及如何在Android开发中使用它们。 什么是扩展函数?...在Android开发中使用扩展函数 在Android开发中,扩展函数可以帮助我们简化代码,提高开发效率。以下是一些常见的Android开发场景,可以使用扩展函数来优化代码。...简化findViewById 在Android开发中,我们经常需要使用findViewById来查找布局中的控件。使用扩展函数,我们可以将findViewById封装起来,使其更易用和可读。...开发中,我们经常需要使用RecyclerView来显示列表数据。...在Android开发中,扩展函数可以帮助我们简化代码,提高开发效率。合理的运用扩展函数的能力,可以让你的开发事半功倍,希望本文能够对你有所帮助。
Android开发中基础动画技巧的应用 一、引言 我是先入门iOS的移动开发者,提到动画开发,iOS开发者很容易联想到3种方式,UIImageView的帧动画,UIView层的属性动画和...由于Android开发的固有特点,其在进行动画编程时也支持使用代码和xml配置文件两种方式。本篇博客,将主要向大家介绍这3种创建Android动画方式的使用方法与可以做到的效果。...关于参照点的相对位置类型,Animation类中定义了几个常量供开发者选择使用,意义如下: //绝对定位 以当前窗口做参照 public static final int ABSOLUTE = 0; /...1.ObjectAnimator动画的应用 ObjectAnimator是Property Animation动画体系中最简单易用的一种方式,开发者只需要设置要改变的属性值和一些动画参数即可使用...上面的示例代码只是演示了ValueAnimator的工作原理,开发者可以在onAnimationUpdate()方法中进行任意属性的修改。
因为写博客总是需要录制 Android 软件的演示效果, 研究了将近一小时找到了合适的工具; 录制流程 : -- 1....录制 Android 手机屏幕内容 : 使用 拍大师 软件录制 Android 屏幕内容; -- 2. 导出视频 : 将 拍大师 录制的 MP4 格式的视频导出到电脑上; -- 3....录制 Android 屏幕 工具准备 : -- 拍大师 PC 版 : http://dashi.aipai.com/, 本页面需要下载下 PC 版的拍大师, 用于给手机临时授权拍摄权限, 非 root...; -- Android 客户端下载地址 : http://app.aipai.com/paidashi, 在本页面下载 拍大师 Android apk 文件; 使用流程 : -- Android
> android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com.../tools" android:layout_width="match_parent" android:layout_height="match_parent" android:...> android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com...android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >...(Selector 标签) android="http://schemas.android.com/apk/res/android"> android
——雨果 很多朋友不会用 LogCat 看日志 View logs with Logcat | Android Studio | Android Developers 这个是官方文档,例如这里可以反向筛选...在 Android Studio 中,在物理设备或模拟器上构建并运行您的应用。 从菜单栏中选择“视图”>“工具窗口”>“Logcat”。 默认情况下,Logcat 滚动到末尾。...更改配色方案 要更改配色方案,请导航至 Android Studio > 设置 > 编辑器 > 配色方案。要更改日志视图的配色方案,请选择 Android Logcat。...附加配置选项 有关其他配置选项,请导航至 Android Studio > 设置 > 工具 > Logcat。...Android Studio 中的拆分 Logcat 窗口。 在 Logcat 工具栏中,您可以滚动到日志末尾,也可以单击特定行以保持该行可见。
如果你可以修改源码,你可以在程序执行最初的地方去加sleep逻辑,但这个好复杂,需要重打包,有不少工作要做,下面说一个简单的技巧: adb shell am set-debug-app -w --persistent...用如下命令清除等待调试效果: adb shell am clear-debug-app *your.app.package* 参考: http://android-dev-life.blogspot.com
在 Android Studio 中,最基本的以 debug 模式运行程序并打断点进行调试,相比大家都会,不过,如果遇到一些特殊的调试场景,则需要运用一些特殊的调试技巧来进行调试。...调试 Android SDK 源码 在一些特殊的场景,需要调试 Android SDK 源码中产生的异常,通过 Android SDK 源码中产生的现象发现自己写的代码逻辑的问题。...这种情况下,需要使用原生 Android ROM 来进行调试,因为通常来说,第三方产商自己的 ROM 都进行了不同程度的定制,一般第三方 ROM 的字节码都与 Android Studio 提供的 SDK...另外一点需要注意的是,如果需要调试 Android SDK 源码,需要保证 build.gralde 中配置的 minSdkVersion 与系统的版本相对应,如果临时需要调试 Android SDK...另外,调试某个版本的 Android SDK 源码,需要先下载源码,然后通过 IDE 的跳转功能进入源码,然后就像对普通正常代码一样进行调试即可: Android Sources 调试 NDK 代码
领取专属 10元无门槛券
手把手带您无忧上云