当前位置: 编程技术>移动开发
本页文章导读:
▪动态设立view的padding和margin值 动态设置view的padding和margin值
1.动态设置padding,拿ImageView为例:
ImageView imageView = new ImageView(Context context);
imageView.setPadding(left,top,right,bottom);
2.动态设置margin
拿LinearLayout里边放ImageVIew例
Lin.........
▪ DedeCMS启用二级域名后,原网址跳转二级域名的解决方法 DedeCMS启用二级域名后,原网址跳转二级域名的解决办法
1、DedeCMS顶级栏目启用二级域名,参考以下2篇文章,在此不作赘述。
DedeCMS栏目二级域名设置教程:http://www.d8zhan.com/dedecms/2614.html
.........
▪ Java兑现Zip压缩,解压缩(一) Java实现Zip压缩,解压缩(一)
package org;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
publ.........
[1]动态设立view的padding和margin值
来源: 互联网 发布时间: 2014-02-18
动态设置view的padding和margin值
1.动态设置padding,拿ImageView为例:
ImageView imageView = new ImageView(Context context); imageView.setPadding(left,top,right,bottom);2.动态设置margin
拿LinearLayout里边放ImageVIew例
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(20, 20); params.setMargins(20, 0, 20, 0); imageView.setLayoutParams(params);
[2] DedeCMS启用二级域名后,原网址跳转二级域名的解决方法
来源: 互联网 发布时间: 2014-02-18
DedeCMS启用二级域名后,原网址跳转二级域名的解决办法
1、DedeCMS顶级栏目启用二级域名,参考以下2篇文章,在此不作赘述。
DedeCMS栏目二级域名设置教程:http://www.d8zhan.com/dedecms/2614.html
IIS服务器下做301永久重定向设置方法:http://www.d8zhan.com/db/php_bc/7945.html
2、启用二级域名后,有朋友发现原网址、二级域名都可以访问同一篇文章,如www.d8zhan.com/help/caiji/2543.html和help.d8zhan.com/caiji/2543.html,www.d8zhan.com/help/caiji/2543.html并没有自动跳转到 help.d8zhan.com/caiji/2543.html。
这时,我们可以在iis6里对目录help做下重定向,方法如下:右键“help”,选择“属性”->“目录”,然后设置重定向到URL:http://help.d8zhan.com$s$q,然后选择下面1、3两项,保存即可。
推荐阅读:织梦DedeCMS启用二级域名图片路径错误问题的解决办法
[3] Java兑现Zip压缩,解压缩(一)
来源: 互联网 发布时间: 2014-02-18
Java实现Zip压缩,解压缩(一)
package org; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; public class Zip { public static void zip(String zipFileName, String inputFile) throws Exception { File f = new File(inputFile); ZipOutputStream out = new ZipOutputStream(new FileOutputStream( zipFileName)); zip(out, f, null); System.out.println("zip done"); out.close(); } private static void zip(ZipOutputStream out, File f, String base) throws Exception { System.out.println("zipping " + f.getAbsolutePath()); if (f != null && f.isDirectory()) { File[] fc = f.listFiles(); if (base != null) out.putNextEntry(new ZipEntry(base + "/")); base = base == null ? "" : base + "/"; for (int i = 0; i < fc.length; i++) { zip(out, fc[i], base + fc[i].getName()); } } else { out.putNextEntry(new ZipEntry(base)); FileInputStream in = new FileInputStream(f); int b; while ((b = in.read()) != -1) out.write(b); in.close(); } } public static void unzip(String zipFileName, String outputDirectory) throws Exception { ZipInputStream in = new ZipInputStream(new FileInputStream(zipFileName)); ZipEntry z; while ((z = in.getNextEntry()) != null) { String name = z.getName(); if (z.isDirectory()) { name = name.substring(0, name.length() - 1); File f = new File(outputDirectory + File.separator + name); f.mkdir(); System.out.println("MD " + outputDirectory + File.separator + name); } else { System.out.println("unziping " + z.getName()); File f = new File(outputDirectory + File.separator + name); f.createNewFile(); FileOutputStream out = new FileOutputStream(f); int b; while ((b = in.read()) != -1) out.write(b); out.close(); } } in.close(); } public void deleteFolder(File dir) { File filelist[] = dir.listFiles(); int listlen = filelist.length; for (int i = 0; i < listlen; i++) { if (filelist[i].isDirectory()) { deleteFolder(filelist[i]); } else { filelist[i].delete(); } } dir.delete(); } /** * Test ZIP/UNZIP * @param args */ public static void main(String[] args) { try { Zip t = new Zip(); t.zip("c:\\test.zip","c:\\test"); //在c盘要自己提前建立test文件夹 // t.unzip("c:\\test.zip","c:\\test"); File file = new File("c:\\test"); t.deleteFolder(file); } catch (Exception e) { e.printStackTrace(System.out); } } }
最新技术文章: