Android学习笔记之ImageView显示图片

 更新时间:2016年9月20日 20:00  点击:1386
本文章来给大家介绍关于Android学习笔记之ImageView显示图片,在于android中ImageView是Android程序中经常用到的组件,它将一个图片显示到屏幕上。
 代码如下 复制代码


public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myimage);
ImageView image1 = (ImageView) findViewById(R.myImage.image);
//Bitmap bitmap = getLoacalBitmap("/aa/aa.jpg"); //从本地取图片
Bitmap bitmap =
getHttpBitmap("hpath.jpg");
//从网上取图片
image1 .setImageBitmap(bitmap); //设置Bitmap
}

/**
* 加载本地图片
* http://www.111cn.net
* @param url
* @return
*/
public static Bitmap getLoacalBitmap(String url) {
try {
FileInputStream fis = new FileInputStream(url);
return BitmapFactory.decodeStream(fis);
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
}

/**
* 从服务器取图片
*http://www.111cn.net
* @param url
* @return
*/
public static Bitmap getHttpBitmap(String url) {
URL myFileUrl = null;
Bitmap bitmap = null;
try {
Log.d(TAG, url);
myFileUrl = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
HttpURLConnection conn = (HttpURLConnection) myFileUrl.openConnection();
conn.setConnectTimeout(0);
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(is);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
return bitmap;
}

ImageView 无法setImageBitmap,不显示图片解决办法

以下是handler

 代码如下 复制代码
handler.post(new Runnable() {
                        @Override
                        public void run() {
                                playAdver();
                        }
                });

以下是playAdver()方法,主要是显示图片

 代码如下 复制代码

        private void playAdver() {
                for (int i = 0; i < advertisementsList.size(); i++) {
                        advertisement = advertisementsList.get(i);
                        fileName = advertisement.getName();
                        index = advertisement.getName().indexOf(".");
                        String postfix = fileName.substring(index, fileName.length());
                        time = advertisement.getTime() * 100;
                         if (postfix.compareToIgnoreCase(".jpg") == 0
                                        || postfix.compareToIgnoreCase(".png") == 0) {
                                adverImage.setVisibility(View.VISIBLE);
                                adverImage.setImageBitmap(BitmapFactory.decodeFile(fileName));
                                try {
                                        Thread.sleep(time);
                                } catch (InterruptedException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();
                                }
                        }
                }
        }

执行了adverImage.setImageBitmap(BitmapFactory.decodeFile(fileName));但是在真机上不现实图片,为什么?
因为我是在主线程里面执行的,故不会显示,以解决

本文章给大家介绍一篇关于android中利用ImageView 图片循环播放代码,功能由三个文件组成一个是xml,一个是主处理文件,另一个是预览文件了,有需要了解的朋友可参考。

xml

 代码如下 复制代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:id="@+id/linearLayout" >
 
</LinearLayout>

主文件:

 代码如下 复制代码

public class picBarActivity extends Activity{
        private LinearLayout linearLayout;
        private picBar myView;
         
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                // TODO Auto-generated method stub
                super.onCreate(savedInstanceState);
                setContentView(R.layout.pic_progress);
                 
                linearLayout = (LinearLayout)this.findViewById(R.id.linearLayout);
                myView = new picBar(this);
                linearLayout.addView(myView);
        }
}

View文件:

 代码如下 复制代码


public class picBar extends View{          
 
        int COMPONENT_WIDTH;//控件的宽度  
        int COMPONENT_HEIGHT;//控件的高度  
        boolean initflag = false;//是否已经初始化图片  
        Bitmap[] bmp;//用来存放图片的数组  
        int currIndex = 0;//当前播放图片的ID  
        int[] bitmapId;//图片编号ID  
        boolean workFlag = true;//播放图片的线程标识位  
 
        public picBar(Context context) {
                super(context);
                 
                //首先,要播放图片,就先要有图片,那就先给各个图片编号吧,这里的图片资源存放在了res下的drawable文件夹下了  
                bitmapId =new int[]{R.drawable.loading1_03, R.drawable.loading2_03, R.drawable.loading3_03}; 
                 
                //好了,图片的编号现在已经搞定了,接下来该干什么呢?对,应该将资源里的图片塞进Bitmap数组了,那么我们先来确定将要播放的图片的数量,即Bitmap数组的长度
                bmp = new Bitmap[bitmapId.length];//这里不要直接将数值赋给bmp,因为我们可能会不定期地更换图片资源,这样我们就要修改多处代码,而我们这样根据  
 
                //图片的ID来确定图片的数量,以减少不必要的麻烦,下面开始初始化图片,我们将初始化图片放在一个函数里  
                initBitmap();//图片初始化完毕  
 
                //图片初始化完毕了,接下来我们要做的就是播放图片了,但是播放图片之前,我们有一个问题,就是怎样让图片实现循环播放?这里我们另开一个新的线程来定时更改  
 
                //要播放的图片的ID,以实现图片的循环播放,要实现循环播放图片的功能,我们需要覆写onDraw函数,首先,我们来新开一个线程  
 
                new Thread(){  
 
                        //重写run方法  
                        public void run(){
                                // TODO Auto-generated method stub  
                                while(workFlag)//一直执行这个循环(死循环)  
                                {  
                                        currIndex = (currIndex+1)%bitmapId.length;//更改图片的ID  
                                        picBar.this.postInvalidate();//刷新屏幕,导致屏幕重绘  
                                        try
                                        {  
                                                Thread.sleep(3000);//到此处暂停3秒钟,然后继续执行run函数,即实现每隔3秒钟刷新屏幕一次  
                                        } 
                                        catch (InterruptedException e)   
                                        {  
                                                // TODO Auto-generated catch block  
                                                e.printStackTrace();  
                                        } 
                                } 
                        } 
                }.start(); 
        }
 
        //初始化图片  
 
        public void initBitmap()  
 
        {  
 
                //获取资源图片  
 
                Resources res = this.getResources();  
 
                for(int i=0;i<bitmapId.length;i++){  
                        bmp<I> = BitmapFactory.decodeResource(res, bitmapId<I>);  
                } 
        } 
 
        //覆写onDraw方法  
        @Override
        protected void onDraw(Canvas canvas)   
        {  
                // TODO Auto-generated method stub  
                super.onDraw(canvas);  
                if(!initflag)//检查是偶已经获取控件的宽和高,如果没有,那么就获取控件的宽和高  
                {  
                        COMPONENT_WIDTH = this.getWidth();  
                        COMPONENT_HEIGHT = this.getHeight();  
                        initflag = true;  
                } 
                Paint p = new Paint();
                canvas.drawBitmap(bmp[currIndex], 0, 0, p);//绘制图片  
        } 
 
}

本文章为安卓开发者入门者介绍关于Android Debug Bridge (ADB)的使用方法,有需要学习的朋友可进入参考。

 

Android系统调试工具——ADB

Android Debug Bridge是个多功能的工具,可以管理设备上的执行状况。
即ADB是管理模拟器的一个工具。

包括下列三个部分:

客户端程序(Client):在开发环境上运行,也可以通过命令行模式shell接口执行adb命令来操作客户端程序。其他Android工具如开发工具ADT或调试监控系统DDMS都可以创建一个adb客户端。

服务器程序(Server):在开发环境的后台运行,服务器程序负责管理介于客户端程序和守护进程程序的通信沟通。
守护进程程序(Daemon):在实际硬件设备或虚拟设备的后台运行。
adb命令位于安装路径下的platform-tools路径中,把这个路径加在环境变量PATH中就可以在其他目录下使用adb命令。

adb命令的标准格式

adb [-d|-e|-s <serialNumber>] <command>
这是adb命令的标准格式,当你正在执行的仿真器有多个时,要加上仿真器序号来区别:

使用“-s <serialNumber>”选项参数;
使用“-d”选项参数,adb命令只会送到连接USB的实际硬设备;
使用“-e”选项参数,adb命令只会送到Android仿真器。

后面<command>是必要的命令。

安装与卸载应用程序apk文件

安装:
adb [-s <serialNumber>] install <path_to_apk>

范例:安装helloWorld.apk到Android仿真器序列号是5556的虚拟设备上:

 adb –s emulator-5556 install helloWorld.apk
 adb install helloWorld.apk

使用adb install安装apk组件程序时,安装在Android仿真器上的apk组件会被放在Android系统目录的/data/app下,这个目录下的应用程序文件名就是写程序时设置的Package name

卸载:

 adb [-s <serialNumber>] uninstall <package>
范例:

adb –s emulator-5556 uninstall com.example.android.helloWorld.apk
adb uninstall com.example.android.helloWorld.apk

注意安装是接apk文件路径名称,而移除是接package名称。

手动删除:

  adb shell
  cd data/app
  rm app.apk

Android操作系统命令行模式,使用shell命令

  执行

  adb shell

  可以进入Android操作系统命令行模式,如此一来你就可以管理和查询Android操作系统的目录和执行相关的命令。

  因为Android操作系统是Linux操作系统的一种,所以shell命令和Linux操作系统是相同的,例如ls命令显示文件目录,cd命令更改文件目录,mkdir命令创建目录,rmdir命令删除目录,rm命令删除文件,mv命令移动文件。

  进入Android操作系统命令行模式后,要离开回到控制台窗口,可以使用exit命令。

上传文件到/sdcard或自/sdcard下载文件(复制文件)

  上传,即从系统复制文件到设备:
  adb push <local> <remote>
  如:adb push d:test.txt /sdcard/
  下载,即从设备复制文件到系统:
  adb pull <remote> <local>
  如:adb pull /sdcard/test.txt d:/

发布端口

  可以设置任意的端口号,作为主机向模拟器或设备的请求端口。如:
  adb forward tcp:5555 tcp:8000

搜索/等待模拟器、设备实例

  取得当前运行的模拟器,设备的实例列表及每个实例的状态|等待正在运行的设备。
  adb devices
  adb wait-for-device

 

查看Bug报告

  adb bugreport

记录无线通讯日志

  adb shell
  logcat –b radio


获取设备ID和序列号

  adb get-product

  adb get-serialno

访问数据库SQLite3

  adb shell
  sqlite3

我们曾经在其他文章中通过对录音以及录像的实现方法具体讲解过有Android多媒体录制功能的实现方式介绍 的相关操作技巧。在这里我们将会为大家详细介绍一下Android多媒体播放的应用方式,以帮助大家对这方面的应用知识有一个深刻的印象。


Android多媒体播放代码:

 代码如下 复制代码


import android.app.Activity; 
import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener; 
import android.widget.Button;
  import android.widget.VideoView; 
public class VideoPlayer extends Activity   {
  /**   Called when the activity is first created.
  */
@Override
  public void onCreate(Bundle icicle)   {
  super.onCreate(icicle);
  setContentView(R.layout.main);
  final VideoView w =(VideoView)findViewById(R.id.vdoplayer);
  Button cmdload = (Button)this.findViewById(R.id.cmd_load);   cmdload.setOnClickListener(new OnClickListener()  { 
public void onClick(View arg0)   {  
// TODO Auto-generated method stub
  w.setVideoPath("/sdcard/android/kongfu.mp4");
  } 

); 
Button cmdplay = (Button)this.findViewById(R.id.cmd_play); 
cmdplay.setOnClickListener(new OnClickListener()  {  
public void onClick(View arg0)   { 
// TODO Auto-generated method stub 
w.start(); 
}
  } 
);  
Button cmdpause = (Button)this.findViewById(R.id.cmd_pause);   cmdpause.setOnClickListener(new OnClickListener()  {
  public void onClick(View arg0)   {
  // TODO Auto-generated method stub
  w.pause(); 
}
  }
  );
  }

Android多媒体播放实现代码:
xml文件:

 代码如下 复制代码


< ?xml version="1.0" encoding="utf-8"?>
< LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
< Button android:id="@+id/cmd_load"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="load" />
< Button android:id="@+id/cmd_play"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Play" />
< Button android:id="@+id/cmd_pause"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="pause" />
< VideoView android:id="@+id/vdoplayer"
android:layout_width="fill_parent"
android:layout_height="300px" />
< /LinearLayout>

本文章来介绍在android开发中,我们通过button按钮来动态改变字体大小、字体颜色、背景颜色代码,有需要了解的朋友可参考参考。

实现的逻辑:通过遍历View的方式,判断View是否是TextView、EditText和Button类型,如果是的话,就修改。

代码如下:
1、xml布局文件,文件名:test4.xml,内容如下:

 代码如下 复制代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:orientation="vertical"
   android:id="@+id/mainLayout">
    
     
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
         
        <EditText android:id="@+id/fontSize"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="30"
        android:hint="请输入数字"/>
         
        <Button android:id="@+id/ChangeSize"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="改变字体"/>    
         
    </LinearLayout>
     
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
         
        <EditText android:id="@+id/fontColor"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="#ffffff"
        android:hint="请输入字体颜色"/>
         
        <Button android:id="@+id/ChangeColor"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="改变字体颜色" />    
         
    </LinearLayout>
     
     
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
         
        <EditText android:id="@+id/bgColor"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="#ff0000"
        android:hint="请输入背景颜色"/>
         
        <Button android:id="@+id/ChangeBgColor"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="改变背景颜色"/>    
         
    </LinearLayout>
     
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
      
    
   <TextView android:id="@+id/TextView01"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="top"
                   android:gravity="top"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView02"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="bottom"
                   android:gravity="bottom"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView03"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="left"
                   android:gravity="left"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView04"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="right"
                   android:gravity="right"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView05"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="center_vertical"
                   android:gravity="center_vertical"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView06"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="fill_vertical"
                   android:gravity="fill_vertical"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView07"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="center_horizontal"
                   android:gravity="center_horizontal"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView08"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="fill_horizontal"
                   android:gravity="fill_horizontal"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>                                                                                                                                     
 
   <TextView android:id="@+id/TextView09"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="center"
                   android:gravity="center"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView10"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="fill"
                   android:gravity="fill"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView11"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="clip_vertical"
                   android:gravity="clip_vertical"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
                    
   <TextView android:id="@+id/TextView12"
                   android:layout_width="fill_parent"
                   android:layout_height="50dp"
                   android:text="clip_horizontal"
                   android:gravity="clip_horizontal"
                   android:textColor="#ffffff"
                   android:background="#00ff00"
                   android:layout_margin="2px"/>
    </LinearLayout>                                                                                               
</LinearLayout>

2、实现的代码文件:MainActivity.java,代码如下:

 代码如下 复制代码

package org.shuxiang.test;
 
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
public class MainActivity extends Activity{
         
        private LinearLayout mainLayout;
        private Button changeSize, changeColor, changeBgColor;
        private EditText fontSize, fontColor, bgColor;
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.test4);
         
        mainLayout = (LinearLayout) findViewById(R.id.mainLayout);
        changeSize = (Button) findViewById(R.id.ChangeSize);
        fontSize = (EditText) findViewById(R.id.fontSize);
         
        changeSize.setOnClickListener(new OnClickListener()
        {
                        @Override
                        public void onClick(View v)
                        {
                                // TODO Auto-generated method stub
                                setFontSize(mainLayout, Float.parseFloat(fontSize.getText().toString()));
                        }                
        });
         
        changeColor = (Button) findViewById(R.id.ChangeColor);
        fontColor = (EditText) findViewById(R.id.fontColor);
         
        changeColor.setOnClickListener(new OnClickListener()
        {
                        @Override
                        public void onClick(View v)
                        {
                                // TODO Auto-generated method stub
                                int color = Integer.parseInt(fontColor.getText().toString().replace("#", ""), 16);
                                int red = (color & 0xff0000) >> 16; 
                            int green = (color & 0x00ff00) >> 8; 
                            int blue = (color & 0x0000ff); 
                             
                            setFontColor(mainLayout, Color.rgb(red, green, blue));                                
                        }                
        });
         
        changeBgColor = (Button) findViewById(R.id.ChangeBgColor);
        bgColor = (EditText) findViewById(R.id.bgColor);
         
        changeBgColor.setOnClickListener(new OnClickListener()
        {
                        @Override
                        public void onClick(View v)
                        {
                                // TODO Auto-generated method stub
                                int color = Integer.parseInt(bgColor.getText().toString().replace("#", ""), 16);
                                int red = (color & 0xff0000) >> 16; 
                            int green = (color & 0x00ff00) >> 8; 
                            int blue = (color & 0x0000ff);
                             
                                setBgColor(mainLayout, Color.rgb(red, green, blue));
                        }                
        });        
 
        
    }
     
    /**
     * 改变字体
     * @param v
     * @param fontSize
     */
    public void setFontSize(View v, float fontSizeValue)
    {
            if(v instanceof TextView)
                {
                        ((TextView) v).setTextSize(fontSizeValue);
                }
                else if(v instanceof EditText)
                {
                        ((EditText) v).setTextSize(fontSizeValue);
                }
                else if(v instanceof Button)
                {
                        ((Button) v).setTextSize(fontSizeValue);
                }
                else
                {
                        int vChildCount = ((ViewGroup) v).getChildCount();
                    for(int i=0; i<vChildCount; i++)
                    {
                            View v1 = ((ViewGroup) v).getChildAt(i);
                            setFontSize(v1, fontSizeValue);
                    }
                }        
    }
     
    /**
     * 改变字体颜色
     * @param v
     * @param fontSize
     */
    public void setFontColor(View v, int fontColorValue)
    {
            if(v instanceof TextView)
                {
                        ((TextView) v).setTextColor(fontColorValue);
                }
                else if(v instanceof EditText)
                {
                        ((EditText) v).setTextColor(fontColorValue);
                }
                else if(v instanceof Button)
                {
                        ((Button) v).setTextColor(fontColorValue);
                }
                else
                {
                        int vChildCount = ((ViewGroup) v).getChildCount();
                    for(int i=0; i<vChildCount; i++)
                    {
                            View v1 = ((ViewGroup) v).getChildAt(i);
                            setFontColor(v1, fontColorValue);
                    }
                }        
    }
     
    /**
     * 改变背景字体
     * @param v
     * @param fontSize
     */
    public void setBgColor(View v, int bgColorValue)
    {
            if(v instanceof TextView)
                {
                        ((TextView) v).setBackgroundColor(bgColorValue);
                }
                else if(v instanceof EditText)
                {
                        ((EditText) v).setBackgroundColor(bgColorValue);
                }
                else if(v instanceof Button)
                {
                        ((Button) v).setBackgroundColor(bgColorValue);
                }
                else
                {
                        int vChildCount = ((ViewGroup) v).getChildCount();
                    for(int i=0; i<vChildCount; i++)
                    {
                            View v1 = ((ViewGroup) v).getChildAt(i);
                            setBgColor(v1, bgColorValue);
                    }
                }        
    }    
 
}

[!--infotagslink--]

相关文章

  • 使用PHP+JavaScript将HTML页面转换为图片的实例分享

    这篇文章主要介绍了使用PHP+JavaScript将HTML元素转换为图片的实例分享,文后结果的截图只能体现出替换的字体,也不能说将静态页面转为图片可以加快加载,只是这种做法比较interesting XD需要的朋友可以参考下...2016-04-19
  • C#从数据库读取图片并保存的两种方法

    这篇文章主要介绍了C#从数据库读取图片并保存的方法,帮助大家更好的理解和使用c#,感兴趣的朋友可以了解下...2021-01-16
  • Photoshop古装美女图片转为工笔画效果制作教程

    今天小编在这里就来给各位Photoshop的这一款软件的使用者们来说说把古装美女图片转为细腻的工笔画效果的制作教程,各位想知道方法的使用者们,那么下面就快来跟着小编一...2016-09-14
  • php抓取网站图片并保存的实现方法

    php如何实现抓取网页图片,相较于手动的粘贴复制,使用小程序要方便快捷多了,喜欢编程的人总会喜欢制作一些简单有用的小软件,最近就参考了网上一个php抓取图片代码,封装了一个php远程抓取图片的类,测试了一下,效果还不错分享...2015-10-30
  • Python 图片转数组,二进制互转操作

    这篇文章主要介绍了Python 图片转数组,二进制互转操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-03-09
  • Android子控件超出父控件的范围显示出来方法

    下面我们来看一篇关于Android子控件超出父控件的范围显示出来方法,希望这篇文章能够帮助到各位朋友,有碰到此问题的朋友可以进来看看哦。 <RelativeLayout xmlns:an...2016-10-02
  • 利用JS实现点击按钮后图片自动切换的简单方法

    下面小编就为大家带来一篇利用JS实现点击按钮后图片自动切换的简单方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧...2016-10-25
  • jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮

    jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮...2013-10-13
  • js实现上传图片及时预览

    这篇文章主要为大家详细介绍了js实现上传图片及时预览的相关资料,具有一定的参考价值,感兴趣的朋友可以参考一下...2016-05-09
  • Photoshop枪战电影海报图片制作教程

    Photoshop的这一款软件小编相信很多的人都已经是使用过了吧,那么今天小编在这里就给大家带来了用Photoshop软件制作枪战电影海报的教程,想知道制作步骤的玩家们,那么下面...2016-09-14
  • Android开发中findViewById()函数用法与简化

    findViewById方法在android开发中是获取页面控件的值了,有没有发现我们一个页面控件多了会反复研究写findViewById呢,下面我们一起来看它的简化方法。 Android中Fin...2016-09-20
  • Android模拟器上模拟来电和短信配置

    如果我们的项目需要做来电及短信的功能,那么我们就得在Android模拟器开发这些功能,本来就来告诉我们如何在Android模拟器上模拟来电及来短信的功能。 在Android模拟...2016-09-20
  • 夜神android模拟器设置代理的方法

    夜神android模拟器如何设置代理呢?对于这个问题其实操作起来是非常的简单,下面小编来为各位详细介绍夜神android模拟器设置代理的方法,希望例子能够帮助到各位。 app...2016-09-20
  • android自定义动态设置Button样式【很常用】

    为了增强android应用的用户体验,我们可以在一些Button按钮上自定义动态的设置一些样式,比如交互时改变字体、颜色、背景图等。 今天来看一个通过重写Button来动态实...2016-09-20
  • Android WebView加载html5页面实例教程

    如果我们要在Android应用APP中加载html5页面,我们可以使用WebView,本文我们分享两个WebView加载html5页面实例应用。 实例一:WebView加载html5实现炫酷引导页面大多...2016-09-20
  • 深入理解Android中View和ViewGroup

    深入理解Android中View和ViewGroup从组成架构上看,似乎ViewGroup在View之上,View需要继承ViewGroup,但实际上不是这样的。View是基类,ViewGroup是它的子类。本教程我们深...2016-09-20
  • Android自定义WebView网络视频播放控件例子

    下面我们来看一篇关于Android自定义WebView网络视频播放控件开发例子,这个文章写得非常的不错下面给各位共享一下吧。 因为业务需要,以下代码均以Youtube网站在线视...2016-10-02
  • Android用MemoryFile文件类读写进行性能优化

    java开发的Android应用,性能一直是一个大问题,,或许是Java语言本身比较消耗内存。本文我们来谈谈Android 性能优化之MemoryFile文件读写。 Android匿名共享内存对外A...2016-09-20
  • python opencv通过4坐标剪裁图片

    图片剪裁是常用的方法,那么如何通过4坐标剪裁图片,本文就详细的来介绍一下,感兴趣的小伙伴们可以参考一下...2021-06-04
  • Android设置TextView竖着显示实例

    TextView默认是横着显示了,今天我们一起来看看Android设置TextView竖着显示如何来实现吧,今天我们就一起来看看操作细节,具体的如下所示。 在开发Android程序的时候,...2016-10-02