Skip to content

Instantly share code, notes, and snippets.

# Glide 加载本地图片
public static final String ANDROID_RESOURCE = "android.resource://";
public static final String FOREWARD_SLASH = "/";
private static Uri resourceIdToUri(Context context, int resourceId) {
return Uri.parse(ANDROID_RESOURCE + context.getPackageName() + FOREWARD_SLASH + resourceId);
}
//这可能是任何 Uri。为了演示的目的我们只是用一个 launcher icon 去创建了一个 Uri
Can't build android. Execution failed for task ':generateJsonModelDebug'.
因为没有ninja
https://stackoverflow.com/questions/54500937/cocos2d-x-android-build-failed
#!/bin/env python
from PIL import Image
from os.path import realpath
from os import getcwd
from sys import argv
from setproctitle import setproctitle
allprojects {
repositories {
jcenter()
}
gradle.taskGraph.whenReady {
tasks.each { task ->
if (task.name.equals('mockableAndroidJar')) {
task.enabled = false
}
}
adb tcpip 5555 # 5555为一个自定义的端口,只要与下一行命令的端口保持统一即可
adb connect 192.168.0.101:5555 # 192.168.0.101为手机无线网络的ip地址
adb usb
```
ViewOutlineProvider实现圆角
roundImage.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 30);
}
});
roundImage.setClipToOutline(true);
https://juejin.im/post/5d689058e51d4562054103e0
- 长按进入拖拽
- 增加拖拽时间监听
```
import android.content.ClipData;
import android.content.ClipDescription;
import android.graphics.Color;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
/*
* Copyright (C) 2016 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
@monkeydone
monkeydone / android2gif
Created February 26, 2019 02:58
android screen to gif file
#/bin/bash
function createGif() {
if [ -e $mp4_name ]; then
rm -rf $mp4_name
fi
echo "record the screen"
adb shell screenrecord $mp4_name --size 1080x1920 --time-limit 10
echo "download the screen file"