12 2012 档案
摘要:protected void replaceFragment(Fragment fragment , boolean init) { FragmentManager fragmentManager = this.getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); if(init) { fragmentTransaction.add(R.id.main_...
阅读全文
摘要:1、Camera 可以实现3D平移、旋转等特效:2、它并不是以Galley视图所在坐标系,而是在其自身的坐标系3、例如,其绕Y轴旋转,实际是在matrix 对应视图的左边旋转;平移也是同样。package com.view;import android.content.Context;import android.graphics.Camera;import android.graphics.Matrix;import android.util.AttributeSet;import android.view.View;import android.view.animation.Transfo
阅读全文
摘要:1、 SlidingDrawer 抽屉控件 <SlidingDrawer android:id="@+id/sliding" android:layout_width="match_parent" android:layout_height="match_parent" android:content="@+id/home_water" // 指定内容控件id android:handle="@+id/handler" // 指定handler 控件id android:ori...
阅读全文
摘要:private void showPopupView() { if (mPopupWindow == null) { View view = getLayoutInflater().inflate(R.layout.newest_layout, null); mPopupWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mPopupWindow.setFocusable(tr...
阅读全文
摘要:1、一种方法是将其中一个项目(含有res资源)打包成jar包,另一个项目来引用。但是多次尝试总是发现找不到资源2、第二种方法参考http://www.cnblogs.com/vaiyanzi/archive/2012/02/20/2358910.html将其中一个项目设置为引用的库,在另一个项目中添加这个库引用。简单点的做法是在被引用项目A中的project-properties 中添加一行 android.library=true在引用的项目B 中添加android.library.reference.1=../A其中 1表示引用的包的序号,“../A”表示 引用的项目的路径
阅读全文
摘要:1、描述:计算翻开的卡片到平面的投影来模拟卡片打开的效果 。视点位于卡片上边缘中点正上方。 以w、h表示原卡片的宽高,w1、h1表示投影的宽高,H表示视点高度 , a为翻开的卡片与平面上的卡片夹角,有以下公式:h1 = h*cosa *H /(H-h*sina)w1 = w*H/(H-h*sina)投影计算算法(这里仅考虑了第一象限)为: public ImageBuffer openCard(int[] pixels, int width, int height, double pi) { final int H = width * 3; double...
阅读全文
摘要:1、使用find找到文件并显示find . -name '*.apk' -exec echo {} \; // ‘{}’ ,'\;' 间有空格或者 :find . -name '*.apk'2、找到并且删除文件 find . -name '*.apk' -exec rm {} \; 其中 ‘.’ 表示当前目录 , -name 表示按照名字查找更多特性:http://www.chinaz.com/server/2009/0807/85796.shtml
阅读全文
摘要:/**归并排序,稳定 ,时间复杂度O(nlogn) 空间复杂度O(n)*/ public static void mergeSort(int[] a , int l ,int h , int[] temp) 9 { 10 if(a== null ||l >=h)return; 11 12 int m = l + (h-l)/2; 13 mergeSort(a , l , m , temp ); 14 mergeSort(a , m+1 , h, temp); 15 16 merge(a , l ,m, h , temp); 17 } 18 ...
阅读全文
摘要:## r表示读 rb表示读二进制 file_object = open('test.py','r')try: file_text=file_object.read()finally: file_object.close()print file_text## 可以直接用for循环遍历文件每行file_input= open('test.py', 'r')try: for line in file_input: print linefinally: file_input.close()## 或者使用readlines读取每行file_
阅读全文

浙公网安备 33010602011771号