当前位置: 编程技术>移动开发
本页文章导读:
▪ubuntu下设立ip和dns ubuntu下设置ip和dns
1 设置静态IP修改/etc/network/interfaces文件保持之前的关于 lo的内容不变,即以下两行auto loiface lo inet loopback并添加auto ech0iface eth0 inet staticaddress 192.168.3.90gateway 192.168.3.1netmask.........
▪ 运用百度地图画轨迹 使用百度地图画轨迹
百度地图画轨迹连接线。
package com.life.hua.activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Pai.........
▪ 给界面到任何控件截图并保存为PNG的方法 给界面上任何控件截图并保存为PNG的方法
UIView *view = [[[[[UIApplication sharedApplication] windows] objectAtIndex:1] subviews] lastObject];//获得某个window的某个subView
NSInteger index = 0;//用来给保存的png命.........
[1]ubuntu下设立ip和dns
来源: 互联网 发布时间: 2014-02-18
ubuntu下设置ip和dns
1 设置静态IP
修改/etc/network/interfaces文件
保持之前的关于 lo的内容不变,即以下两行
auto lo
iface lo inet loopback
并添加
auto ech0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
2 配置DNS
修改/etc/resolv.conf文件.
nameserver 192.168.3.2
nameserver 192.168.23.22
在ubuntu10.04中没有resolv.conf文件,需要自己添加。
1 设置静态IP
修改/etc/network/interfaces文件
保持之前的关于 lo的内容不变,即以下两行
auto lo
iface lo inet loopback
并添加
auto ech0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
2 配置DNS
修改/etc/resolv.conf文件.
nameserver 192.168.3.2
nameserver 192.168.23.22
在ubuntu10.04中没有resolv.conf文件,需要自己添加。
[2] 运用百度地图画轨迹
来源: 互联网 发布时间: 2014-02-18
使用百度地图画轨迹
百度地图画轨迹连接线。
百度地图画轨迹连接线。
package com.life.hua.activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Style; import android.graphics.Path; import android.graphics.Point; import android.os.Bundle; import com.baidu.mapapi.BMapManager; import com.baidu.mapapi.GeoPoint; import com.baidu.mapapi.MapActivity; import com.baidu.mapapi.MapController; import com.baidu.mapapi.MapView; import com.baidu.mapapi.Overlay; import com.baidu.mapapi.Projection; import com.life.hua.activity.BaseApplication; import com.life.hua.activity.R; public class BaiduMapActivity extends MapActivity { private Context mContext; private MapView mapView; @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } private GeoPoint gpoint1, gpoint2, gpoint3;// 连线的点 @Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.baidumap_layout); BaseApplication baseApp = (BaseApplication) this.getApplication(); if (baseApp.mBMapManage == null) { baseApp.mBMapManage = new BMapManager(mContext); baseApp.mBMapManage.init(baseApp.mStrKey, new BaseApplication.MyGeneralListener()); } baseApp.mBMapManage.start(); super.initMapActivity(baseApp.mBMapManage);// 初始化map sdk mapView = (MapView) findViewById(R.id.bmapView); mapView.setBuiltInZoomControls(true); // 设置在缩放动画过程中也显示overlay,默认为不绘制 mapView.setDrawOverlayWhenZooming(true); // RouteLine routeLine = // (RouteLine)getIntent().getSerializableExtra("routeLine"); //这里画点和连接线 MyOverlay myOverlay = new MyOverlay(); mapView.getOverlays().add(myOverlay); MapController mapController = mapView.getController(); mapController.zoomIn(); gpoint1 = new GeoPoint((int) (2259316 * 10), (int) (11396279 * 10)); gpoint2 = new GeoPoint((int) (2259245 * 10), (int) (11396226 * 10)); gpoint3 = new GeoPoint((int) (2259121 * 10), (int) (11396066 * 10)); mapController.animateTo(gpoint1);//设置一个起点 } class MyOverlay extends Overlay { @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, shadow); Projection projection = mapView.getProjection(); Point p1 = new Point(); Point p2 = new Point(); Point p3 = new Point(); // 经度转像素 projection.toPixels(gpoint1, p1); projection.toPixels(gpoint2, p2); projection.toPixels(gpoint3, p3); //第一个画笔 画圆 Paint fillPaint = new Paint(); fillPaint.setColor(Color.BLUE); fillPaint.setAntiAlias(true); fillPaint.setStyle(Style.FILL); // 将图画到上层 canvas.drawCircle(p1.x, p1.y, 5.0f, fillPaint); canvas.drawCircle(p2.x, p2.y, 5.0f, fillPaint); canvas.drawCircle(p3.x, p3.y, 5.0f, fillPaint); //第二个画笔 画线 Paint paint = new Paint(); paint.setColor(Color.BLUE); paint.setDither(true); paint.setStyle(Paint.Style.STROKE); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeCap(Paint.Cap.ROUND); paint.setStrokeWidth(4); //连接 Path path = new Path(); path.moveTo(p1.x, p1.y); path.lineTo(p2.x, p2.y); path.lineTo(p3.x, p3.y); //画出路径 canvas.drawPath(path, paint); } } }
[3] 给界面到任何控件截图并保存为PNG的方法
来源: 互联网 发布时间: 2014-02-18
给界面上任何控件截图并保存为PNG的方法
UIView *view = [[[[[UIApplication sharedApplication] windows] objectAtIndex:1] subviews] lastObject];//获得某个window的某个subView NSInteger index = 0;//用来给保存的png命名 for (UIView *subView in [view subviews]) {//遍历这个view的subViews if ([subView isKindOfClass:NSClassFromString(@"UIImageView")] || [subView isKindOfClass:NSClassFromString(@"UIThreePartButton")]) {//找到自己需要的subView //支持retina高分的关键 if(UIGraphicsBeginImageContextWithOptions != NULL) { UIGraphicsBeginImageContextWithOptions(subView.frame.size, NO, 0.0); } else { UIGraphicsBeginImageContext(subView.frame.size); } //获取图像 [subView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //保存图像 NSString *path = [NSHomeDirectory() stringByAppendingFormat:@"/%d.png",index]; if ([UIImagePNGRepresentation(image) writeToFile:path atomically:YES]) { index += 1; NSLog(@"Succeeded!"); } else { NSLog(@"Failed!"); } } }
最新技术文章: