Skip to content

Instantly share code, notes, and snippets.

@yuanliwei
yuanliwei / Android版本号.md
Created January 5, 2016 03:11
Android版本号
Name API Level Revision Version Code
Android 6.0 23 2 Marshmallow(Android M)
Android 5.1.0 22 2 Lollipop(Android L)
Android 5.0.1 21 2 Lollipop(Android L)
Android 4.4W.2 20 2 KitKat
Android 4.4.2 19 4 KitKat
Android 4.3.1 18 3 Jelly Bean
Android 4.2.2 17 3 JELLY_BEAN_MR1
Android 4.1.2 16 5 JELLY_BEAN
@yuanliwei
yuanliwei / ViewAnimator 使用.md
Created January 5, 2016 08:00
ViewAnimator 使用

ViewAnimator 使用

布局

<ViewAnimator
    android:id="@+id/sample_output"
    android:layout_width="match_parent"
    android:layout_height="0px"
    android:layout_weight="1"
 android:inAnimation="@android:anim/fade_in"
@yuanliwei
yuanliwei / Gradle环境变量配置.md
Created January 6, 2016 13:36
Gradle环境变量配置

Gradle环境变量配置

  • GRADLE_HOME = C:\Gradle
  • PATH = %GRADLE_HOME%\bin
  • 运行gradle -v检查安装是否正确
@yuanliwei
yuanliwei / 修改Gradle仓库地址.md
Created January 7, 2016 17:00
修改Gradle仓库地址

修改Gradle仓库地址


buildscript {
    repositories {
        maven { url 'http://maven.oschina.net/content/groups/public/' }

    }
    dependencies {
 classpath 'com.android.tools.build:gradle:1.5.0'
@yuanliwei
yuanliwei / PowerShell查看目录下文件夹大小.md
Last active January 11, 2016 16:55
PowerShell查看目录下文件夹大小

PowerShell查看目录下文件夹大小

function filesize ([string]$filepath)
 {
     $result=@() 
     if ($filepath -eq $null)
     {
         throw "路径不能为空"
     }
 dir -Path $filepath |
@yuanliwei
yuanliwei / MessageDetailActivity.java
Created January 13, 2016 17:24
WebView 支持HTML5 中 Video 视频全屏播放功能
web.setWebChromeClient(new WebChromeClient() {
private CustomViewCallback myCallback;
private View videoView;
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
if (myCallback != null) {
myCallback.onCustomViewHidden();
myCallback = null;
@yuanliwei
yuanliwei / Android 设置硬件加速.md
Last active January 13, 2016 17:33
Android 设置硬件加速

Android 设置硬件加速

  1. 整个应用都要开启硬件加速:< application ... android:hardwareAccelerated ="true">
  2. 在一个Activity中开启硬件加速:
    • <activity ... android:hardwareAccelerated="true" >
    • getWindow.addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
  3. 取消指定View上的硬件加速:view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
@yuanliwei
yuanliwei / Android替换hosts的方法.md
Last active January 15, 2016 16:13
Android替换hosts的方法

Android替换hosts的方法

  1. adb shell
  2. su root
  3. cd /system/etc
  4. mount
  5. 退出adb shell
  6. adb shell su root chmod -R 777 /system/etc/hosts
  7. adb push hosts /system/etc/hosts
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@yuanliwei
yuanliwei / js鼠标移动事件.md
Created February 3, 2016 09:01
js鼠标移动事件

js鼠标移动事件

		canvas.addEventListener('mousemove', doMouseMove, false);
		function doMouseMove(e) {
			var x = e.clientX;
			var y = e.clientY;
			var p = getPointOnCanvas(canvas, e);

			var box = canvas.getBoundingClientRect()