Time of Update: 2018-12-05
之前在網上找了很多都沒有這方面的資料,大概的效果是當Gallery滑動時不下載圖片,當Gallery滑動停止時載入當前頁面圖片,自己花了一點時間大概的實現了,如果各位有更好的意見歡迎說出來大家一起學習。先看看效果:這圖是在載入圖片時顯示的預設圖片,當圖片載入完成則替換。圖片載入完成import java.util.ArrayList;import java.util.HashMap;import java.util.List;import android.app.Activity;import
Time of Update: 2018-12-05
在 Android 上使用 Intent 開啟視頻連結的問題 Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("http://www.yourvideo.mp4"), "video/mp4"); view.getContext().startActivity(intent); 檢測 Android 中的某個 Intent 是否有效public static boolean
Time of Update: 2018-12-05
Activity載入模式standard: 標準模式,一調用startActivity()方法就會產生一個新的執行個體。
Time of Update: 2018-12-05
布局:main.xml:<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"
Time of Update: 2018-12-05
在網上收集到了TextView 的屬性,在開發過程中還是挺有用的。android:autoLink設定是否當文本為URL連結/email/電話號碼/map時,文本顯示為可點擊的連結。可選值(none/web/email/phone/map/all)android:autoText如果設定,將自動執行輸入值的拼字糾正。此處無效果,在顯示IME並輸入的時候起作用。android:bufferType指定getText()方式取得的文本類別。選項editable
Time of Update: 2018-12-05
URL fileURL = null;Bitmap bitmap = null;try {fileURL = new URL(picUrl);} catch (MalformedURLException err) {err.printStackTrace();}try {HttpURLConnection conn = (HttpURLConnection)
Time of Update: 2018-12-05
最近在學貝茲路徑,在網上找了些文章,感覺都不怎麼樣,就在前輩的基礎上進行了些修改。下面貼出代碼:【改天貼上很美的】MySurfaceView.javapackage mojia.main;import java.util.Random;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import
Time of Update: 2018-12-05
可以開機啟動一個服務進行動態註冊優先順序設定最大值:android:priority="2147483647"
Time of Update: 2018-12-05
在 Android 上,因為 Google 自己實現的 Android 標配的 GCM (Google Cloud Messaging,原來叫 C2DM) 在國內基本不可用,所以,對於開發人員來說,如果需要 Push功能,怎麼樣選擇成為了一個問題。到目前為止,國內尚沒有完全向開發人員免費、開放的 Push 服務可用。國外有幾家第三方推送服務,但一般都要收費。所以一般來說,國內的開發人員不得不考慮自己來搭建 Push服務。自己構建
Time of Update: 2018-12-05
public class VideoActivity extends Activity {private static final String TAG = "VideoActivity";private EditText filenameText;private SurfaceView surfaceView;private MediaPlayer mediaPlayer;@Overridepublic void onCreate(Bundle savedInstanceState) {
Time of Update: 2018-12-05
public static Bitmap createReflectedImage(Bitmap originalImage) { final int reflectionGap = 4; int width = originalImage.getWidth(); int height = originalImage.getHeight(); Matrix matrix = new Matrix(); matrix.preScale(1, -1);
Time of Update: 2018-12-05
1、要有Root許可權,和sd卡寫入權限2、備份App本身//引用:http://blog.csdn.net/KPRF2009/article/details/8277996private void backupApp(String packageName) throws IOException { File in = new File("/data/app/" + packageName + ".apk"); File out = new
Time of Update: 2018-12-05
Android平台下實現漸層效果。在android.graphics中我們可以找到有關Gradient字樣的類,比如LinearGradient 線性漸層、RadialGradient放射狀漸層和 角度漸層SweepGradient
Time of Update: 2018-12-05
1.ComponentName此類主要是擷取是包名Activity名,以及提轉到此Activity使用 ntent.setComponent(componetName); startActivity(intent);2. startActivities(Intent[]) startActivities(buildIntentsToViewsLists());
Time of Update: 2018-12-05
記得網路許可權,開子線程操作。依賴的三個jar包:activation.jar additionnal.jar mail.jar:Android_Email核心代碼:Authenticator authenticator = new Authenticator() {@Overrideprotected PasswordAuthentication getPasswordAuthentication() {return new
Time of Update: 2018-12-05
package com.example.demoandroid;import android.app.Activity;import android.os.Bundle;import android.view.MotionEvent;import android.view.animation.Animation;import android.view.animation.Animation.AnimationListener;import
Time of Update: 2018-12-05
今天看官網的《Tasks and Back Stack》,按照裡面的說法 Intent.FLAG_ACTIVITY_NEW_TASK 或是 AndroidManifest.xml 設定 android:launchMode="singleTask" 發現均不能建立一個task,上網查了一下,原來是這樣的 每個Activity都有taskAffinity屬性,這個屬性指出了它希望進入的Task。如果一個
Time of Update: 2018-12-05
關鍵代碼:@Overrideprotected void onNewIntent(Intent intent) {Logger.i("onNewIntent");super.onNewIntent(intent);if (opened) {// 關閉// parameters = mCamera.getParameters();parameters.setFlashMode(Parameters.FLASH_MODE_OFF);mCamera.setParameters(parameters);
Time of Update: 2018-12-05
1.文本控制項 TextView跑馬燈效果:系統提供的textView文本雖然內建跑馬燈效果但是只有擷取到焦點的時候才能實現效果,所以需要重寫TextView類的isFocused()方法使它永遠返回truepublic class ScrollForeverTextView extends TextView {public ScrollForeverTextView(Context context) {super(context);// TODO Auto-generated
Time of Update: 2018-12-05
我們常見的長度單位有:px, dip, sp1. px (pixels)像素:這個大家用得比較多, 一般我們HVGA代表320x480像素。2. dip或dp (device independent pixels)裝置獨立像素:這個和裝置硬體有關,一般我們為了支援WVGA、HVGA和QVGA cwj推薦使用這個,不依賴像素。3. sp (scaled pixels — best for text size)放大像素: 主要處理字型的大小。下面的不經常用到:4. in (inches)英寸+ v%