1、增加配置信息:
adb shell setprop [key] [value] adb shell setprop persist.isilent.me 123456
2、查看配置信息:
adb shell getprop [key] adb shell getprop persist.isilent.me
注意:必须采用persist.开头的属性名才能永久保存
参考链接:
1、增加配置信息:
adb shell setprop [key] [value] adb shell setprop persist.isilent.me 123456
2、查看配置信息:
adb shell getprop [key] adb shell getprop persist.isilent.me
注意:必须采用persist.开头的属性名才能永久保存
参考链接:
当RecyclerView属性设置为wrap_content
+maxHeight
时,maxHeight没有效果。
<android.support.v7.widget.RecyclerView android:id="@+id/recyclerView" ... android:layout_height="wrap_content" android:maxHeight="300dp" ... />
查看源码时发现,当RecyclerView的LayoutManager#isAutoMeasureEnabled()返回true时,RecyclerView高度取决于children view的布局高度,并非取决于RecyclerView自身的测量高度。
@Override protected void onMeasure(int widthSpec, int heightSpec) { ... if (mLayout.mAutoMeasure) { ... // now we can get the width and height from the children. mLayout.setMeasuredDimensionFromChildren(widthSpec, heightSpec); if (mLayout.shouldMeasureTwice()) { ... // now we can get the width and height from the children. mLayout.setMeasuredDimensionFromChildren(widthSpec, heightSpec); } } else { ... } }
因此,我们只需要重写LayoutManager的
public void setMeasuredDimension(Rect childrenBounds, int wSpec, int hSpec)
方法即可为RecyclerView设置最大宽高。
override fun setMeasuredDimension(childrenBounds: Rect, wSpec: Int, hSpec: Int) { super.setMeasuredDimension(childrenBounds, wSpec, View.MeasureSpec.makeMeasureSpec(maxHeight, AT_MOST)) }
在日常开发中,想直接通过android:maxHeight或android:maxWidth在布局文件中限制RecyclerView的最大高度宽度,是无法实现的。通过自定义RecyclerView,覆盖onMeasure方法。在onMeasure方法内部,当发现自身高度或宽度超过限制的最大高度或宽度,则手动将宽或高设置为期望的最大宽或搞。具体代码实现如下: 继续阅读【转】RecyclerView限制最大高度或宽度
为什么会有这一篇“重新介绍”呢?因为 JavaScript 堪称世界上被人误解最深的编程语言。虽然常被嘲为“玩具语言”,但在它看似简洁的外衣下,还隐藏着强大的语言特性。 JavaScript 目前广泛应用于众多知名应用中,对于网页和移动开发者来说,深入理解 JavaScript 就尤为必要。
与大多数编程语言不同,JavaScript 没有输入或输出的概念。它是一个在宿主环境(host environment)下运行的脚本语言,任何与外界沟通的机制都是由宿主环境提供的。浏览器是最常见的宿主环境,但在非常多的其他程序中也包含 JavaScript 解释器,如 Adobe Acrobat、Adobe Photoshop、SVG 图像、Yahoo! 的 Widget 引擎,Node.js 之类的服务器端环境,NoSQL 数据库(如开源的 Apache CouchDB)、嵌入式计算机,以及包括 GNOME (注:GNU/Linux 上最流行的 GUI 之一)在内的桌面环境等等。
JavaScript 是一种多范式的动态语言,它包含类型、运算符、标准内置( built-in)对象和方法。它的语法来源于 Java 和 C,所以这两种语言的许多语法特性同样适用于 JavaScript。JavaScript 通过原型链而不是类来支持面向对象编程(有关 ES6 类的内容参考这里Classes,有关对象原型参考见此继承与原型链)。JavaScript同样支持函数式编程——因为它们也是对象,函数也可以被保存在变量中,并且像其他对象一样被传递。
转载自:npm,yarn如何查看源和换源
npm, yarn查看源和换源:
npm config get registry // 查看npm当前镜像源 npm config set registry https://registry.npm.taobao.org/ // 设置npm镜像源为淘宝镜像 yarn config get registry // 查看yarn当前镜像源 yarn config set registry https://registry.npm.taobao.org/ // 设置yarn镜像源为淘宝镜像
镜像源地址部分如下:
npm --- https://registry.npmjs.org/ cnpm --- https://r.cnpmjs.org/ taobao --- https://registry.npm.taobao.org/ nj --- https://registry.nodejitsu.com/ rednpm --- https://registry.mirror.cqupt.edu.cn/ npmMirror --- https://skimdb.npmjs.com/registry/ deunpm --- http://registry.enpmjs.org/
饼图适合在什么地方使用?
饼图主要用于展现不同类别数值相对于总数的占比情况。图中每个分块(扇区)的弧长表示该类别的占比大小,所有分块数据总和为100%。当分块过多,容易造成饼图丑化,建议尽量将饼图分块数量控制在五个以内。当数据类别较多时,可以把较小或不重要的数据合并成第五个模块命名为”其它”。如果各类别都必须全部展示,此时选择柱状图或堆积柱状图或许更合适。
Android目前并没有原生支持的图表Api,所以如果要类似饼图之类的图表,只能自己撸代码或者用别人的轮子。自己撸代码,费时费力,而且容易引入无数的Bug。目前在GitHub比较成熟的的图表库就是MPAndroid,英文水平不错的可以撸文档,或者用Google翻译。
MPAndroid Github地址
节选自:这些年,我所经历的所有面试|写给正在求职的 Androider
以下是面试中遇到的问题整理,有一些被我整理已被整理成博文,其他的都是我这些年积累的面试笔记,虽然不是很全面,但是已经是我保留的全部了。希望有帮助。
*排序算法
转载自:Android recyclerview的滑动到指定的item
1.滑动到指定位置的方法要写在数据真正加载完成以后,而不是加载数据方法的后面。
2.指定的位置是否可见。
public static void MoveToPosition(int n) { manager.scrollToPosition(n); }
转载自:Android Architecture Samples
Comparing MVC, MVP and MVVM in android through a complete movie search app
This is the complementary repository to the series of articles on my website.
branch: no-architecture
article: android architecture: Part 1: introduction
branch: mvc
article: android architecture: Part 2: MVC
branch: mvp
article: android architecture: Part 3: MVP
branch: mvvm-rxjava
article: android architecture: Part 4: MVVM with RxJava
branch: mvvm-livedata
article: android architecture: Part 5: MVVM with LiveData
branch: mvvm-liveData&viewModel
article: android architecture: Part 6: MVVM with LiveData and ViewModel
branch: mvvm-liveData&viewModel-revised
article: android architecture: Part 7: ViewModel with LiveData and RxJava
branch: mvp-easymvp
article: Easy MVP library for android