该文档翻译自 Android 5.0 文档中对 Material Design 的介绍,原文地址:http://developer.android.com/training/material/drawables.html
Drawables 的以下功能帮助你在你的应用中实现 Material Design:
- 将图像染色
- 提取图像中的显著颜色
- 矢量图像(Vector Drawables)
该课程向你展示如何在你的应用中使用这些特性。
//inside a fragment. If in an Activity you could use findViewById(Window.ID_ANDROID_CONTENT); | |
getView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() | |
{ | |
@Override | |
public void onGlobalLayout() | |
{ | |
//do something like measure a view etc | |
View content = getWindow().findViewById(Window.ID_ANDROID_CONTENT); | |
Log.d("DISPLAY", content.getWidth() + " x " + content.getHeight()); | |
该文档翻译自 Android 5.0 文档中对 Material Design 的介绍,原文地址:http://developer.android.com/training/material/drawables.html
Drawables 的以下功能帮助你在你的应用中实现 Material Design:
该课程向你展示如何在你的应用中使用这些特性。
# These commands will help you setup the Rails test environment without problems | |
# | |
# MAKE SURE YOU HAVE VIRTUAL BOX INSTALLED http://www.virtualbox.org/wiki/Downloads | |
# | |
# Copy paste all of following commands in your normal terminal and the following things will happen: | |
# - rails_test_box dir is created | |
# - rails master branch is checkout in the dir rails | |
# - A Gemfile is created and all the gems to run the virtualbox are installed using bundler | |
# - The rails vagrant box is downloaded and added to your vagrant boxes | |
# - A Vagrantfile is created for vagrant |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
doc = open('http://railscasts.com/') { |f| Hpricot(f) } | |
total_episodes = (doc/'div.number').first.inner_html[1,3].to_i | |
total_pages = (total_episodes / 10).ceil | |
(1..total_pages).each do |i| | |
puts "PAGE #{i} ================================" |
require "bundler/capistrano" | |
# Define your server here | |
server "<server>", :web, :app, :db, primary: true | |
# Set application settings | |
set :application, "<app_name>" | |
set :user, "<deployment_user>" # As defined on your server | |
set :deploy_to, "/home/#{user}/apps/#{application}" # Directory in which the deployment will take place | |
set :deploy_via, :remote_cache |
对编程有了系统的概念,之前总是从入门到放弃,这次终于自己能够做出完整的作品,对于自己学习其它技能的自信心也大大增强了,自己的小创意有了实现的能力,对于编程的越来越有热情。
关于全栈,之前一直觉得自己很全能,什么都会一点,但是在参加 jdstore 比赛的时候发现,一个人的时间是非常有限的,和他人配合能够大大的提高效率,大家一起做才能够在有限的时间内完成理想中的工作量,所以自己会做是一方面,懂得和人配合,团队之间的沟通也非常重要。
import android.support.v4.app.Fragment; | |
public class FragmentUtils { | |
/** | |
* @param fragment | |
* The Fragment whose parent is to be found | |
* @param parentClass | |
* The interface that the parent should implement | |
* @return The parent of fragment that implements parentClass, |
package com.mcxiaoke.urlexpander; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.net.Proxy; | |
import android.os.Build; | |
import android.os.Parcelable; | |
import android.util.ArrayMap; | |
import org.apache.http.HttpHost; |
wget --no-check-certificate https://raw.github.com/seebi/dircolors-solarized/master/dircolors.ansi-dark
mv dircolors.ansi-dark .dircolors
eval `dircolors ~/.dircolors`
git clone https://github.com/sigurdga/gnome-terminal-colors-solarized.git
cd gnome-terminal-colors-solarized
./set_dark.sh
/** | |
* Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable). | |
* In the ghost bitmap, the RGB values take on the values from the 'color' argument, while | |
* the alpha values are derived from the source's grayscaled RGB values. The effect is that | |
* you can see through darker parts of the source bitmap, while lighter parts show up as | |
* the given color. The 'invert' argument inverts the computation of alpha values, and looks | |
* best when the given color is a dark. | |
*/ | |
private Bitmap createGhostIcon(Drawable src, int color, boolean invert) { | |
int width = src.getIntrinsicWidth(); |