• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            xiaoguozi's Blog
            Pay it forword - 我并不覺的自豪,我所嘗試的事情都失敗了······習慣原本生活的人不容易改變,就算現狀很糟,他們也很難改變,在過程中,他們還是放棄了······他們一放棄,大家就都是輸家······讓愛傳出去,很困難,也無法預料,人們需要更細心的觀察別人,要隨時注意才能保護別人,因為他們未必知道自己要什么·····

            實現全屏函數:



               private void setFullScreen(){ 
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
            }

            退出全屏函數:



              private void quitFullScreen(){ 
            final WindowManager.LayoutParams attrs = getWindow().getAttributes();
            attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
            getWindow().setAttributes(attrs);
            getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
            }
            posted @ 2012-03-17 23:47 小果子 閱讀(149) | 評論 (0)編輯 收藏

            Android里有兩個類
            android.view.GestureDetector
            android.view.GestureDetector.SimpleOnGestureListener

            1)新建一個類繼承SimpleOnGestureListener,HahaGestureDetectorListener ,可以實現以下event事件:
            boolean  onDoubleTap(MotionEvent e) :雙擊的第二下Touch down時觸發
            boolean  onDoubleTapEvent(MotionEvent e) :雙擊的第二下Touch down和up都會觸發,可用e.getAction()區分。
            boolean  onDown(MotionEvent e) :Touch down時觸發
            boolean  onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) :Touch了滑動一點距離后,up時觸發。
            void  onLongPress(MotionEvent e) :Touch了不移動一直Touch down時觸發
            boolean  onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) :Touch了滑動時觸發。
            void  onShowPress(MotionEvent e) :Touch了還沒有滑動時觸發(onDown只要Touch down一定立刻觸發;Touch down后過一會沒有滑動先觸發onShowPress再是onLongPress;Touch down后一直不滑動,onDown->onShowPress->onLongPress這個順序觸發。)
            boolean  onSingleTapConfirmed(MotionEvent e) ,boolean  onSingleTapUp(MotionEvent e) :這兩個函數都是在touch down后又沒有滑動(onScroll),又沒有長按(onLongPress),然后Touchup時觸發。
            點擊一下非常快的(不滑動)Touchup: onDown->onSingleTapUp->onSingleTapConfirmed
            點擊一下稍微慢點的(不滑動)Touchup: onDown->onShowPress->onSingleTapUp->onSingleTapConfirmed

            2)在view的新建一個GestureDetector的對象。
            構造函數里:gestureDetector = new GestureDetector(new HahaGestureDetectorListener());
            然后在View的onTouchEvent里以下這樣用,就可以在剛才1)弄的事件里寫自己的代碼了。
            @Override
            public boolean onTouchEvent(MotionEvent event) {
                gestureDetector.onTouchEvent(event);
            }

            posted @ 2012-03-17 23:46 小果子 閱讀(981) | 評論 (0)編輯 收藏


             android 2.0開始 加入的 android.media.ExifInterface 包中如下方法讀取相關信息:

             

            /*
            * 目前Android SDK定義的Tag有:
            TAG_DATETIME 時間日期
            TAG_FLASH 閃光燈
            TAG_GPS_LATITUDE 緯度
            TAG_GPS_LATITUDE_REF 緯度參考
            TAG_GPS_LONGITUDE 經度
            TAG_GPS_LONGITUDE_REF 經度參考
            TAG_IMAGE_LENGTH 圖片長
            TAG_IMAGE_WIDTH 圖片寬
            TAG_MAKE 設備制造商
            TAG_MODEL 設備型號
            TAG_ORIENTATION 方向
            TAG_WHITE_BALANCE 白平衡
            */ 

             

            String sFileName="/sdcard/DCIM/Camera/1.JPG";
            try{
            ExifInterface exif = new ExifInterface(sFileName);
            String sModel=exif.getAttribute(ExifInterface.TAG_MODEL);
            Toast.makeText(PhotoCatActivity.this,"1.JPG Exif:"+sModel, Toast.LENGTH_SHORT).show();
            }
            catch(Exception ee){

            }

            posted @ 2012-03-17 23:46 小果子 閱讀(1152) | 評論 (0)編輯 收藏

            001package cn.m15.test;
            002 
            003import java.io.ByteArrayOutputStream;
            004import java.io.File;
            005import android.app.Activity;
            006import android.content.Intent;
            007import android.graphics.Bitmap;
            008import android.net.Uri;
            009import android.os.Bundle;
            010import android.os.Environment;
            011import android.provider.MediaStore;
            012import android.view.View;
            013import android.view.View.OnClickListener;
            014import android.widget.Button;
            015import android.widget.ImageView;
            016 
            017public class testActivity extends Activity {
            018 
            019    public static final int NONE = 0;
            020    public static final int PHOTOHRAPH = 1;// 拍照
            021    public static final int PHOTOZOOM = 2; // 縮放
            022    public static final int PHOTORESOULT = 3;// 結果
            023 
            024    public static final String IMAGE_UNSPECIFIED = "image/*";
            025    ImageView imageView = null;
            026    Button button0 = null;
            027    Button button1 = null;
            028 
            029    @Override
            030    public void onCreate(Bundle savedInstanceState) {
            031        super.onCreate(savedInstanceState);
            032        setContentView(R.layout.main);
            033        imageView = (ImageView) findViewById(R.id.imageID);
            034        button0 = (Button) findViewById(R.id.btn_01);
            035        button1 = (Button) findViewById(R.id.btn_02);
            036 
            037        button0.setOnClickListener(new OnClickListener() {
            038            @Override
            039            public void onClick(View v) {
            040                Intent intent = new Intent(Intent.ACTION_PICK, null);
            041                intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, IMAGE_UNSPECIFIED);
            042                startActivityForResult(intent, PHOTOZOOM);
            043            }
            044        });
            045 
            046        button1.setOnClickListener(new OnClickListener() {
            047 
            048            @Override
            049            public void onClick(View v) {
            050                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            051                intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "temp.jpg")));
            052                startActivityForResult(intent, PHOTOHRAPH);
            053            }
            054        });
            055    }
            056 
            057    @Override
            058    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            059        if (resultCode == NONE)
            060            return;
            061        // 拍照
            062        if (requestCode == PHOTOHRAPH) {
            063            //設置文件保存路徑這里放在跟目錄下
            064            File picture = new File(Environment.getExternalStorageDirectory() + "/temp.jpg");
            065            startPhotoZoom(Uri.fromFile(picture));
            066        }
            067         
            068        if (data == null)
            069            return;
            070         
            071        // 讀取相冊縮放圖片
            072        if (requestCode == PHOTOZOOM) {
            073            startPhotoZoom(data.getData());
            074        }
            075        // 處理結果
            076        if (requestCode == PHOTORESOULT) {
            077            Bundle extras = data.getExtras();
            078            if (extras != null) {
            079                Bitmap photo = extras.getParcelable("data");
            080                ByteArrayOutputStream stream = new ByteArrayOutputStream();
            081                photo.compress(Bitmap.CompressFormat.JPEG, 75, stream);// (0 - 100)壓縮文件
            082                imageView.setImageBitmap(photo);
            083            }
            084 
            085        }
            086 
            087        super.onActivityResult(requestCode, resultCode, data);
            088    }
            089 
            090    public void startPhotoZoom(Uri uri) {
            091        Intent intent = new Intent("com.android.camera.action.CROP");
            092        intent.setDataAndType(uri, IMAGE_UNSPECIFIED);
            093        intent.putExtra("crop", "true");
            094        // aspectX aspectY 是寬高的比例
            095        intent.putExtra("aspectX", 1);
            096        intent.putExtra("aspectY", 1);
            097        // outputX outputY 是裁剪圖片寬高
            098        intent.putExtra("outputX", 64);
            099        intent.putExtra("outputY", 64);
            100        intent.putExtra("return-data", true);
            101        startActivityForResult(intent, PHOTORESOULT);
            102    }
            103}

            01<?xml version="1.0" encoding="utf-8"?>
            02<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            03    android:orientation="vertical" android:layout_width="fill_parent"
            04    android:layout_height="fill_parent">
            05    <TextView android:layout_width="fill_parent"
            06        android:layout_height="wrap_content" android:text="@string/hello" />
            07    <ImageView android:id="@+id/imageID"
            08        android:adjustViewBounds="true" android:maxWidth="50dip"
            09        android:maxHeight="50dip" android:layout_width="wrap_content"
            10        android:layout_height="wrap_content" />
            11    <Button android:id="@+id/btn_01" android:layout_height="50dip"
            12            android:text="相冊" android:layout_width="150dip"/>
            13    <Button android:id="@+id/btn_02" android:layout_height="50dip"
            14            android:text="拍照" android:layout_width="150dip"/>
            15</LinearLayout>


            posted @ 2012-03-15 12:12 小果子 閱讀(486) | 評論 (0)編輯 收藏
            package com.twy.test;

            import android.app.Activity;
            import android.graphics.Bitmap;
            import android.graphics.BitmapFactory;
            import android.graphics.Canvas;
            import android.graphics.Matrix;
            import android.graphics.Paint;
            import android.graphics.drawable.BitmapDrawable;
            import android.graphics.drawable.Drawable;
            import android.graphics.drawable.LayerDrawable;
            import android.os.Bundle;
            import android.view.ViewGroup.MarginLayoutParams;
            import android.widget.ImageView;
            import android.widget.ImageView.ScaleType;
            import android.widget.LinearLayout;
            import android.widget.LinearLayout.LayoutParams;

            public class testDemo extends Activity {
                private LinearLayout lay;

                /** Called when the activity is first created. */
                @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);
                    
                    lay = (LinearLayout) findViewById(R.id.linearLayout1);

                    firstLay();
                
                }

                private void firstLay() {
                    Bitmap mbitmap_c = BitmapFactory.decodeResource(getResources(),
                            R.drawable.cc);
                    Bitmap mbitmap_b = BitmapFactory.decodeResource(getResources(),
                            R.drawable.bb);
                    Bitmap mbitmap_e = BitmapFactory.decodeResource(getResources(),
                            R.drawable.ee);
                    Bitmap mbitmap_f = BitmapFactory.decodeResource(getResources(),
                            R.drawable.ff);
                    
                    Drawable[] array = new Drawable[4];
                    array[0] = new BitmapDrawable(mbitmap_b);
                    array[1] = new BitmapDrawable(mbitmap_c);
                    array[2] = new BitmapDrawable(mbitmap_e);
                    array[3] = new BitmapDrawable(mbitmap_f);
                    
                    LayerDrawable la = new LayerDrawable(array);
                    la.setLayerInset(0, 0, 0, 0, 0);
                    la.setLayerInset(1, 80, 0, 0, 0);
                    la.setLayerInset(2, 160, 0, 0, 0);
                    la.setLayerInset(3, 240, 0, 0, 0);
                    
                    ImageView img = new ImageView(this);
                    img.setImageDrawable(la);
                    
                    lay.addView(img);
                    
                }
            }
            posted @ 2012-03-15 10:44 小果子 閱讀(361) | 評論 (0)編輯 收藏
            僅列出標題
            共58頁: First 16 17 18 19 20 21 22 23 24 Last 
            久久综合综合久久狠狠狠97色88| 精品人妻伦九区久久AAA片69| 无码8090精品久久一区| 久久亚洲高清观看| 久久精品国产亚洲AV麻豆网站| 久久久噜噜噜久久中文字幕色伊伊| 国内精品久久久久久久久电影网| 亚洲综合婷婷久久| 伊人久久精品线影院| 婷婷久久综合九色综合98| 国产精品免费看久久久| 波多野结衣中文字幕久久| 成人久久久观看免费毛片| 成人资源影音先锋久久资源网| 精品永久久福利一区二区| 久久九九有精品国产23百花影院| 国产精品久久久久…| 国产午夜精品理论片久久| 久久青青国产| 亚洲精品乱码久久久久久按摩| 久久婷婷五月综合97色一本一本 | 中文字幕无码久久精品青草| 久久精品成人一区二区三区| 午夜福利91久久福利| 亚洲中文精品久久久久久不卡 | 偷窥少妇久久久久久久久| 久久久久人妻一区精品色| 伊人久久大香线蕉精品| 久久国语露脸国产精品电影| 国产精品一久久香蕉国产线看观看 | 久久久久久免费一区二区三区| 国产精品久久国产精品99盘| 久久最新免费视频| 久久久久成人精品无码中文字幕 | 欧美粉嫩小泬久久久久久久| 国产成人精品久久| 一本大道久久a久久精品综合 | 欧美日韩精品久久久久| AAA级久久久精品无码片| 欧洲国产伦久久久久久久 | 一本一本久久a久久综合精品蜜桃|