1、主页面布局文件

activity_main.xml(仅仅有2个button按钮)

  1. <?xml version="1.0" encoding="utf-8"?
  2.  
  3. >
  4. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5. android:layout_width="fill_parent"
  6. android:layout_height="fill_parent"
  7. android:orientation="vertical">
  8. <Button
  9. android:layout_width="fill_parent"
  10. android:layout_height="wrap_content"
  11. android:onClick="testTuPian"
  12. android:text="測试图片处理" />
  13. <Button
  14. android:layout_width="fill_parent"
  15. android:layout_height="wrap_content"
  16. android:onClick="testDraw"
  17. android:text="測试绘制图形" />
  18. </LinearLayout>

MainActivity.java(启动2个button)

  1. package com.atguigu.l11_graphics;
  2. import android.app.Activity;
  3. import android.content.Intent;
  4. import android.os.Bundle;
  5. import android.view.View;
  6. public class MainActivity extends Activity {
  7. @Override
  8. protected void onCreate(Bundle savedInstanceState) {
  9. super.onCreate(savedInstanceState);
  10. setContentView(R.layout.activity_main);
  11. }
  12. public void testTuPian(View view) {
  13. startActivity(new Intent(this, TuPianTestActivity.class));
  14. }
  15. public void testDraw(View view) {
  16. startActivity(new Intent(this, DrawTestActivity.class));
  17. }
  18. }
  1. 2startActivity(new Intent(this, TuPianTestActivity.class));启动的界面

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMzIxMDYyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

上图布局文件例如以下

activity_tupian_test.xml

  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:layout_width="fill_parent"
  3. android:layout_height="fill_parent"
  4. android:orientation="vertical">
  5. <Button
  6. android:layout_width="match_parent"
  7. android:layout_height="wrap_content"
  8. android:onClick=<span style="color:#ff0000;">"testBD"</span>
  9. android:text="測试Bitmap" />
  10. <Button
  11. android:layout_width="match_parent"
  12. android:layout_height="wrap_content"
  13. android:onClick="<span style="color:#ff0000;">testMatrix</span>"
  14. android:text="測试图片的缩放等处理" />
  15. <Button
  16. android:layout_width="fill_parent"
  17. android:layout_height="wrap_content"
  18. android:text="使用Shape做的button"
  19. android:background="@drawable/shape_test"/>
  20. <ImageView
  21. android:layout_width="wrap_content"
  22. android:layout_height="wrap_content"
  23. android:layout_gravity="center_horizontal"
  24. android:background="@drawable/image_selector"
  25. android:onClick="<span style="color:#ff0000;">clickIV</span>"/>
  26. <Button
  27. android:layout_width="fill_parent"
  28. android:layout_height="wrap_content"
  29. android:text="使用Selector+Shape做的button"
  30. android:background="@drawable/shape_selector"/>
  31. <TextView
  32. android:layout_width="fill_parent"
  33. android:layout_height="wrap_content"
  34. android:background="@drawable/test2"
  35. android:text="A NinePatchDrawable graphic is a stretchable bitmap image, which Android will automatically resize to accommodate the contents of the View in which you have placed it as the background. A NinePatch drawable is a standard PNG image that includes an extra" />
  36. </LinearLayout>

TuPianTestActivity.java

  1. package com.atguigu.l11_graphics;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.Toast;
  8. /*
  9. * 測试操作图片的Activity
  10. */
  11. public class TuPianTestActivity extends Activity {
  12.  
  13. @Override
  14. protected void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.activity_tupian_test);
  17. }
  18.  
  19. public void<span style="color:#ff0000;"> testBD</span>(View v) {
  20. startActivity(new Intent(this, BitmapTestActivity.class));
  21. }
  22.  
  23. public void <span style="color:#ff0000;">testMatrix</span>(View v) {
  24. startActivity(new Intent(this, MatrixTestActivity.class));
  25. }
  26.  
  27. public void <span style="color:#ff0000;">clickIV</span>(View v) {
  28. Toast.makeText(this, "点击了selector", 0).show();
  29. }
  30. }

3、将上图分开来看(从上到下依次展示布局文件或者代码)

3-1、activity_bitmap.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent"
  5. android:orientation="vertical" >
  6. <Button
  7. android:layout_width="fill_parent"
  8. android:layout_height="wrap_content"
  9. android:text="保存图片"
  10. android:onClick="saveImage"/>
  11.  
  12. <ImageView
  13. android:id="@+id/iv_bitmap1"
  14. android:layout_width="fill_parent"
  15. android:layout_height="wrap_content" />
  16.  
  17. <ImageView
  18. android:id="@+id/iv_bitmap2"
  19. android:layout_width="fill_parent"
  20. android:layout_height="wrap_content" />
  21.  
  22. <ImageView
  23. android:id="@+id/iv_bitmap3"
  24. android:layout_width="fill_parent"
  25. android:layout_height="wrap_content" />
  26. </LinearLayout>

BitmapTestActivity.java

  1. package com.atguigu.l11_graphics;
  2.  
  3. import java.io.FileNotFoundException;
  4.  
  5. import android.app.Activity;
  6. import android.content.Context;
  7. import android.graphics.Bitmap;
  8. import android.graphics.Bitmap.CompressFormat;
  9. import android.graphics.BitmapFactory;
  10. import android.os.Bundle;
  11. import android.view.View;
  12. import android.widget.ImageView;
  13.  
  14. /*
  15. Bitmap: 载入一张图片数据到内存中, 都能够封装成一个Bitmap对象
  16. 需求3: 将一个bitmap对象保存到存储空间中
  17. */
  18. public class BitmapTestActivity extends Activity {
  19.  
  20. private ImageView iv_bitmap1;
  21. private ImageView iv_bitmap2;
  22. private ImageView iv_bitmap3;
  23.  
  24. @Override
  25. protected void onCreate(Bundle savedInstanceState) {
  26. super.onCreate(savedInstanceState);
  27. setContentView(R.layout.activity_bitmap);
  28.  
  29. iv_bitmap1 = (ImageView) findViewById(R.id.iv_bitmap1);
  30. iv_bitmap2 = (ImageView) findViewById(R.id.iv_bitmap2);
  31. iv_bitmap3 = (ImageView) findViewById(R.id.iv_bitmap3);
  32.  
  33. //1: 载入资源文件里的图片资源并显示
  34. iv_bitmap1.setImageResource(R.drawable.ic_launcher);
  35.  
  36. //2: 使用bitmapfactory做--载入资源图片
  37. Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher);
  38. iv_bitmap2.setImageBitmap(bitmap);
  39.  
  40. //载入存储空间的图片
  41. Bitmap bitmap2 = BitmapFactory.decodeFile("/storage/sdcard/atguigu.png");
  42. iv_bitmap3.setImageBitmap(bitmap2);
  43. }
  44.  
  45. /**
  46. * 讲bitmap对象保存到存储空间去
  47. * /data/data/包名/files/save.png
  48. */
  49. public void saveImage(View v) {
  50. Bitmap bitmap = BitmapFactory.decodeFile("/storage/sdcard/atguigu.png");
  51. try {
  52. bitmap.compress(CompressFormat.PNG, 100,openFileOutput("save.png", Context.MODE_PRIVATE));
  53. } catch (FileNotFoundException e) {
  54. e.printStackTrace();
  55. }
  56. }
  57. }

3-2、activity_matrix.xml

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMzIxMDYyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent"
  5. android:orientation="vertical" >
  6.  
  7. <LinearLayout
  8. android:layout_width="fill_parent"
  9. android:layout_height="50dip"
  10. android:orientation="horizontal" >
  11.  
  12. <EditText
  13. android:id="@+id/et_matrix_scale"
  14. android:layout_width="fill_parent"
  15. android:layout_height="wrap_content"
  16. android:layout_weight="1.0"
  17. android:text="0.25" />
  18.  
  19. <EditText
  20. android:id="@+id/et_matrix_rotate"
  21. android:layout_width="fill_parent"
  22. android:layout_height="wrap_content"
  23. android:layout_weight="1.0"
  24. android:text="30" />
  25.  
  26. <EditText
  27. android:id="@+id/et_matrix_translateX"
  28. android:layout_width="fill_parent"
  29. android:layout_height="wrap_content"
  30. android:layout_weight="1.0"
  31. android:text="10" />
  32.  
  33. <EditText
  34. android:id="@+id/et_matrix_translateY"
  35. android:layout_width="fill_parent"
  36. android:layout_height="wrap_content"
  37. android:layout_weight="1.0"
  38. android:text="10" />
  39. </LinearLayout>
  40.  
  41. <LinearLayout
  42. android:layout_width="fill_parent"
  43. android:layout_height="50dip"
  44. android:orientation="horizontal" >
  45.  
  46. <Button
  47. android:layout_width="fill_parent"
  48. android:layout_height="wrap_content"
  49. android:layout_weight="1.0"
  50. android:onClick="scaleBitmap"
  51. android:text="缩放" />
  52.  
  53. <Button
  54. android:layout_width="fill_parent"
  55. android:layout_height="wrap_content"
  56. android:layout_weight="1.0"
  57. android:onClick="rotateBitmap"
  58. android:text="旋转" />
  59.  
  60. <Button
  61. android:layout_width="fill_parent"
  62. android:layout_height="wrap_content"
  63. android:layout_weight="1.0"
  64. android:onClick="translateBitmap"
  65. android:text="移动" />
  66.  
  67. <Button
  68. android:layout_width="fill_parent"
  69. android:layout_height="wrap_content"
  70. android:layout_weight="1.0"
  71. android:onClick="clearMatrix"
  72. android:text="还原" />
  73. </LinearLayout>
  74.  
  75. <ImageView
  76. android:id="@+id/iv_matrix_icon"
  77. android:layout_width="wrap_content"
  78. android:layout_height="wrap_content"
  79. android:src="@drawable/ic_launcher"
  80. android:scaleType="matrix"/>
  81.  
  82. </LinearLayout>

MatrixTestActivity.java

  1. package com.atguigu.l11_graphics;
  2. import android.app.Activity;
  3. import android.graphics.Matrix;
  4. import android.os.Bundle;
  5. import android.view.View;
  6. import android.widget.EditText;
  7. import android.widget.ImageView;
  8. /*
  9. Matrix 。中文里叫矩阵。高等数学里有介绍。在图像处理方面,主要是用于平面的缩放、平移、旋转等操作
  10.  
  11. */
  12. public class MatrixTestActivity extends Activity {
  13.  
  14. private EditText et_matrix_scale;
  15. private EditText et_matrix_rotate;
  16. private EditText et_matrix_translateX;
  17. private EditText et_matrix_translateY;
  18.  
  19. private ImageView iv_matrix_icon;
  20.  
  21. @Override
  22. protected void onCreate(Bundle savedInstanceState) {
  23. super.onCreate(savedInstanceState);
  24. setContentView(R.layout.activity_matrix);
  25.  
  26. et_matrix_scale = (EditText) findViewById(R.id.et_matrix_scale);
  27. et_matrix_rotate = (EditText) findViewById(R.id.et_matrix_rotate);
  28. et_matrix_translateX = (EditText) findViewById(R.id.et_matrix_translateX);
  29. et_matrix_translateY = (EditText) findViewById(R.id.et_matrix_translateY);
  30.  
  31. iv_matrix_icon = (ImageView) findViewById(R.id.iv_matrix_icon);
  32. }
  33.  
  34. /**
  35. * 缩放图片
  36. */
  37. Matrix matrix = new Matrix();
  38. public void scaleBitmap(View view) {
  39. // 得到缩放比例--float类型
  40. float sacle = Float.parseFloat(et_matrix_scale.getText().toString());
  41. // 对缩放图片对象设置xy轴缩放比例
  42. matrix.postScale(sacle, sacle);
  43. iv_matrix_icon.setImageMatrix(matrix);
  44. }
  45. /**
  46. * 旋转图片
  47. */
  48. public void rotateBitmap(View view) {
  49. float degrees = Float.parseFloat(et_matrix_rotate.getText().toString());
  50. matrix.postRotate(degrees);
  51. iv_matrix_icon.setImageMatrix(matrix);
  52. }
  53.  
  54. /**
  55. * 移动图片
  56. */
  57. public void translateBitmap(View view) {
  58.  
  59. float dx = Float.parseFloat(et_matrix_translateX.getText().toString());
  60. float dy = Float.parseFloat(et_matrix_translateY.getText().toString());
  61. matrix.postTranslate(dx, dy);
  62. iv_matrix_icon.setImageMatrix(matrix);
  63. }
  64.  
  65. /**
  66. * 还原操作
  67. */
  68. public void clearMatrix(View view) {
  69. //清除数据
  70. matrix.reset();
  71. iv_matrix_icon.setImageMatrix(matrix);
  72. }
  73. }

MatrixTestActivity.java

  1. package com.atguigu.l11_graphics;
  2. import android.app.Activity;
  3. import android.graphics.Matrix;
  4. import android.os.Bundle;
  5. import android.view.View;
  6. import android.widget.EditText;
  7. import android.widget.ImageView;
  8. /*
  9. Matrix ,中文里叫矩阵。高等数学里有介绍。在图像处理方面,主要是用于平面的缩放、平移、旋转等操作
  10.  
  11. */
  12. public class MatrixTestActivity extends Activity {
  13.  
  14. private EditText et_matrix_scale;
  15. private EditText et_matrix_rotate;
  16. private EditText et_matrix_translateX;
  17. private EditText et_matrix_translateY;
  18.  
  19. private ImageView iv_matrix_icon;
  20.  
  21. @Override
  22. protected void onCreate(Bundle savedInstanceState) {
  23. super.onCreate(savedInstanceState);
  24. setContentView(R.layout.activity_matrix);
  25.  
  26. et_matrix_scale = (EditText) findViewById(R.id.et_matrix_scale);
  27. et_matrix_rotate = (EditText) findViewById(R.id.et_matrix_rotate);
  28. et_matrix_translateX = (EditText) findViewById(R.id.et_matrix_translateX);
  29. et_matrix_translateY = (EditText) findViewById(R.id.et_matrix_translateY);
  30.  
  31. iv_matrix_icon = (ImageView) findViewById(R.id.iv_matrix_icon);
  32. }
  33.  
  34. /**
  35. * 缩放图片
  36. */
  37. Matrix matrix = new Matrix();
  38. public void scaleBitmap(View view) {
  39. // 得到缩放比例--float类型
  40. float sacle = Float.parseFloat(et_matrix_scale.getText().toString());
  41. // 对缩放图片对象设置xy轴缩放比例
  42. matrix.postScale(sacle, sacle);
  43. iv_matrix_icon.setImageMatrix(matrix);
  44. }
  45. /**
  46. * 旋转图片
  47. */
  48. public void rotateBitmap(View view) {
  49. float degrees = Float.parseFloat(et_matrix_rotate.getText().toString());
  50. matrix.postRotate(degrees);
  51. iv_matrix_icon.setImageMatrix(matrix);
  52. }
  53.  
  54. /**
  55. * 移动图片
  56. */
  57. public void translateBitmap(View view) {
  58.  
  59. float dx = Float.parseFloat(et_matrix_translateX.getText().toString());
  60. float dy = Float.parseFloat(et_matrix_translateY.getText().toString());
  61. matrix.postTranslate(dx, dy);
  62. iv_matrix_icon.setImageMatrix(matrix);
  63. }
  64.  
  65. /**
  66. * 还原操作
  67. */
  68. public void clearMatrix(View view) {
  69. //清除数据
  70. matrix.reset();
  71. iv_matrix_icon.setImageMatrix(matrix);
  72. }
  73. }

3-3、

shape_test.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android" >
  3.  
  4. <!-- 半径大小 -->
  5. <corners android:radius="10dp" />
  6.  
  7. <!-- 边框 -->
  8. <stroke
  9. android:dashGap="2dp"
  10. android:dashWidth="2dp"
  11. android:width="3dp"
  12. android:color="#FF7F00" />
  13.  
  14. <size
  15. android:height="50dp"
  16. android:width="40dp" />
  17. <!-- 颜色 -->
  18. <solid android:color="#FFD700"></solid>
  19.  
  20. <!-- 覆盖solid -->
  21. <gradient
  22. android:startColor="#ffffff"
  23. android:centerColor="#EE4000"
  24. android:endColor="#ffffff"
  25. android:angle="90"/>
  26. </shape>

3-4、

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMzIxMDYyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

image_selector.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <selector xmlns:android="http://schemas.android.com/apk/res/android" >
  3. <!-- 特别的状态放在前面 -->
  4. <item android:drawable="@drawable/main_index_search_pressed" android:state_pressed="true"/>
  5. <item android:drawable="@drawable/main_index_search_normal"/>
  6. </selector>

3-5、

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMzIxMDYyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

  1. <?
  2.  
  3. xml version="1.0" encoding="utf-8"?
  4.  
  5. >
  6. <selector xmlns:android="http://schemas.android.com/apk/res/android" >
  7. <item android:state_pressed="true">
  8. <shape>
  9. <corners android:radius="4dp"></corners>
  10. <stroke android:width="2dp" android:color="#EEAD0E" android:dashWidth="4dp" android:dashGap="2dp"></stroke>
  11. <size android:height="40dp"></size>
  12. <gradient android:startColor="#ffffff" android:centerColor="#ffffff" android:endColor="#E0FFFF"/>
  13. </shape>
  14. </item>
  15.  
  16. <item>
  17. <shape>
  18. <corners android:radius="2dp"></corners>
  19. <stroke android:width="2dp" android:color="#EE7AE9"></stroke>
  20. <size android:height="40dp"></size>
  21. <solid android:color="#E0FFFF"></solid>
  22. </shape>
  23. </item>
  24.  
  25. </selector>

3-6、(9patch图片)

4、startActivity(new Intent(this, DrawTestActivity.class));启动以下图片

DrawTestActivity.java

  1. package com.atguigu.l11_graphics;
  2.  
  3. import android.app.Activity;
  4. import android.content.Context;
  5. import android.graphics.Canvas;
  6. import android.graphics.Color;
  7. import android.graphics.Paint;
  8. import android.graphics.drawable.ShapeDrawable;
  9. import android.graphics.drawable.shapes.OvalShape;
  10. import android.os.Bundle;
  11. import android.view.View;
  12. public class DrawTestActivity extends Activity {
  13.  
  14. @Override
  15. protected void onCreate(Bundle savedInstanceState) {
  16. super.onCreate(savedInstanceState);
  17. // 显示自己定义视图
  18. setContentView(new MyView(this));
  19. }
  20.  
  21. /**
  22. * 自己定义myview视图
  23. */
  24. private class MyView extends View {
  25. //成员变量---可画的图形对象
  26. private ShapeDrawable shapeDrawable;
  27.  
  28. public MyView(Context context) {
  29. super(context);
  30. // 初始化一个图形对象---參数是椭圆
  31. shapeDrawable = new ShapeDrawable(new OvalShape());
  32. // 通过椭圆得到画笔,通过画笔设置颜色
  33. shapeDrawable.getPaint().setColor(Color.RED);
  34. // 指定位置left top right bottom
  35. shapeDrawable.setBounds(10, 10, 200, 100);
  36. }
  37.  
  38. // 显示界面视图效果 画布
  39. @Override
  40. protected void onDraw(Canvas canvas) {
  41. //设置画布的颜色
  42. canvas.drawColor(Color.GREEN);
  43. // 将图像画到画布上
  44. shapeDrawable.draw(canvas);
  45.  
  46. //指定画笔
  47. Paint paint = new Paint();
  48. //通过画笔设置颜色
  49. paint.setColor(Color.BLUE);
  50. //设置字体大小
  51. paint.setTextSize(30);
  52. //设置平滑度
  53. paint.setAntiAlias(true);
  54. //在画布上写上字体
  55. canvas.drawText("你好", 10, 200, paint);
  56. }
  57. }
  58. }

Graphics简单汇总的更多相关文章

  1. Python中对时间日期的处理方法简单汇总

    这篇文章主要介绍了Python实用日期时间处理方法汇总,本文讲解了获取当前datetime.获取当天date.获取明天/前N天.获取当天开始和结束时间(00:00:00 23:59:59).获取两个d ...

  2. Linux命令面试常考的简单汇总

    1.显示日期与时间的命令:date 2.显示日历的命令:cal 3.简单好用的计算器:bc 4.热键“命令补全或文件补齐”:Tab 5.热键“中断目前程序”:Ctrl+C 6.热键“键盘输入结束(En ...

  3. Linux内存简单汇总

    Linux内存主要用来存储系统和应用程序的指令,数据,缓存等 一,内存映射 1,内核给每个进程提供一个独立的虚拟机地址空间,并且这个地址空间是连续的 2,虚拟地址空间内部又被分为内核空间和用户空间 3 ...

  4. [computer graphics]简单光照模型(Phong和Blinn-Phong)和明暗处理

    简单光照模型(Phong和Blinn-Phong)和明暗处理 支持点光源和平行光,是一种简单光照模型,它将光照分解成了三个部分,分别为 漫反射 镜面反射 环境光 如图所示,是一个简单的几何模型. \( ...

  5. Openstack架构概念图-简单汇总

    OpenStack是一个云平台管理的项目,它不是一个软件.这个项目由几个主要的组件组合起来完成一些具体的工作.想要了解openstack,第一步我们可以观察他的概念图: 针对上图的翻译+解释: 上图主 ...

  6. Spring常用注解简单汇总

    使用注解之前要开启自动扫描功能,其中base-package为需要扫描的包(含子包). <context:component-scan base-package="cn.test&qu ...

  7. sonar阻断级别错误(block)简单汇总

    1.代码里面包含PASSWORD.PWD 'PWD' detected in this expression, review this potentially hardcoded credential ...

  8. HTML5 之 简单汇总

    参考: HTML5的十大新特性 前端面试必备之html5的新特性 HTML5 1.语义化元素 1.1结构元素 标签 描述 article 表示与上下文不相关的独立内容区域 aside 定义页面的侧边栏 ...

  9. 【转】iOS 7免费设计资源汇总

    原文链接:http://mobile.51cto.com/hot-406317.htm#585532-tsina-1-28470-7e393678b940a4d55500bf3feae3d2e9 以下 ...

随机推荐

  1. 【Codeforces1109B_CF1109B】Sasha and One More Name(字符串)

    题目: Codeforces1109B 我打的是 Div2 ,所以我看到的题号实际上是 1113D -- 考场上傻了没敢大力猜结论没做出来这道题,不幸掉分-- 1869->1849 嘤嘤嘤 翻译 ...

  2. “浪潮杯”第九届山东省ACM大学生程序设计竞赛重现赛 C-Cities

    题目描述:There are n cities in Byteland, and the ith city has a value ai. The cost of building a bidirec ...

  3. ANDROID 开发之 SQLite

    SQLite简介 Google为Andriod的较大的数据处理提供了SQLite,他在数据存储.管理.维护等各方面都相当出色,功能也非常的强大.SQLite具备下列特点: 1.轻量级 使用 SQLit ...

  4. [LeetCode]152. Maximum Product Subarray

    This a task that asks u to compute the maximum product from a continue subarray. However, you need t ...

  5. 阿里云虚拟主机针对恶意频繁攻击式访问造成CPU爆满的解决方法

    最近网站CPU经常爆满,到阿里云提交了工单,工程师给我的处理意见:   您好,虚拟主机CPU占用比较高通常这种情况有两种可能:   一是网站应用程序代码逻辑较复杂,或业务架构效率比较低,在请求了某个网 ...

  6. SAS进阶《深入解析SAS》之Base SAS基础、读取外部数据到SAS数据集

    SAS进阶<深入解析SAS>之Base SAS基础.读取外部数据到SAS数据集 前言:在学习完<SAS编程与商业案例>后,虽然能够接手公司的基本工作,但是为了更深入的SAS学习 ...

  7. Android 根据QQ号跳转到QQ聊天界面

    从自己开发的应用中根据QQ号跳转到QQ应用的聊天界面,实现起来很方便: 即: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(" ...

  8. Element type "LinearLayout" must be followed by either attribute specifications, ">" or "/>"的解决办法

    看老师的word文档开始学习.复制了一段代码,在layout中新建了一个Android XML file,发现有提示错误. 代码如下: <?xml version="1.0" ...

  9. 7、scala面向对象编程之类

    1.  定义一个简单的类 2.getter与setter 3.自定义getter与setter方法 4.仅暴露field的getter方法 5.private[this]的使用 6.Java风格的ge ...

  10. 【VHDL】组合逻辑电路和时序逻辑电路的区别

    简单的说,组合电路,没有时钟:时序电路,有时钟. ↓ 也就是说,组合逻辑电路没有记忆功能,而时序电路具有记忆功能. ↓ 在VHDL语言中,不完整条件语句对他们二者的影响分别是什么?组合逻辑中可能生成锁 ...