Time of Update: 2018-12-06
開啟AndroidManifest.xml檔案,在</activity>下面添加這一行:<uses-library android:name="android.test.runner"/> 在</application>下面添加這一行:(把 com.example.readwritexml 改為你待測試的程式包名)<instrumentation android:name="android.test.InstrumentationTestRunner"
Time of Update: 2018-12-06
package com.eboy.checksimoperator;import android.app.Activity;import android.content.Context;import android.os.Bundle;import android.telephony.TelephonyManager;import android.view.Menu;import android.view.View;import android.widget.Toast;public class
Time of Update: 2018-12-06
1.使用VedioView VideoView videoView = (VideoView)findViewById(R.id.video); String src = "rtsp://v6.cache7.c.youtube.com/CjYLENy73wIaLQlSNwWysTZuKRMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYP6mvvezrYeZTgw=/0/0/0/video.3gp";
Time of Update: 2018-12-06
使用搭建好的Eclipse + ADT 環境。在Eclipse中選擇 File > New > Project 功能表項目。如果你已經成功安裝了Android 外掛程式,你會在彈出的新項目對話方塊中看到一個叫做“Android”的條目,包含一個”Android Project”的項目 選中"Android Project",點擊 Next進行入下一步。彈出一個項目屬性視窗,要填寫如下域:Project Name :這是電腦中儲存專案檔目錄的名稱。Package Name
Time of Update: 2018-12-06
User Location主要用於擷取使用者的位置和追蹤使用者的移動 關鍵API: Location Manager用於管理Android的使用者定位服務;Location Provider提供多種定位方式供開發人員使用 定位方式的分類: 1. 使用GPS衛星進行定位,需要在AndroidManifest當中聲名許可權android.permission.ACCESS_FINE_LOCATION 2.
Time of Update: 2018-12-06
直接上代碼,代碼內容上有相應的注釋。效果作簡短介紹,有一個圓形一個方形,當一隻手指觸控的時候只有圓形隨著移動;當兩隻手指觸控的時候圓形與方形各自隨著手指移動。不要忘記使用View.invalidate()對繪圖進行更新。/* import相關class */import android.app.Activity;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;i
Time of Update: 2018-12-06
1. 首先繼承EditText2. 並重寫onTouchEvent方法 public boolean onTouchEvent(MotionEvent event) { Editable ed=this.getEditableText(); //獲得action int action = event.getAction(); //用來顯示文本的Layout布局 Layout layout = this.getLayout();//獲得第幾行 int
Time of Update: 2018-12-06
註冊感應器:使用SensorManager的registerListener(SensorEventListener listener, Sensor sensor, int rate)方法SensorEventListener 有兩個需要實現的方法:1. onAccuracyChanged(Sensor sensor, int
Time of Update: 2018-12-06
1. 改變背景 在res/drawable下建立一個xml檔案: <?xml version="1.0" encoding="UTF-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android">//
Time of Update: 2018-12-06
1. //建立一個線性布局管理器LinearLayout layout = new LinearLayout(this);2. //設定該Activity顯示layoutsuper.setContentView(layout);3. //設定該線性布局的布局方向layout.setOrientation(LinearLayout.VERTICAL);4. //建立一個按鈕Button bn = new Button(this); bn.setText(R.string.ok);5.
Time of Update: 2018-12-06
更多參考:http://www.360doc.com/content/12/0515/13/7857928_211171985.shtml:TabHost的布局:<?xml version="1.0" encoding="utf-8"?><TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_
Time of Update: 2018-12-06
1. Intent open a picture file public: Intent intent = new Intent("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromFile(new
Time of Update: 2018-12-06
首先按照程式的目錄結構大致分析: res/layout/ 這個目錄存放的就是布局用的xml檔案,一般預設為main.xml res/values/ 這個目錄存放的是一堆常量的xml檔案 res/drawable/ 存放的是一些圖片什麼的,當然表徵圖也在這裡 下面主要對layout下的xml檔案做個介紹,順便也把布局的方法總結一下: ·檔案的開頭 <?xml version="1.0" encoding="utf-8"?> 這是在說明xml版本及字元編碼
Time of Update: 2018-12-06
android tools:1. android apk tool一款用於重建apk的工具。可以解壓各種apk包,查看完整的資源等,目前不支援查看原始碼。網址:http://code.google.com/p/android-apktool/2. unyaffs可以解壓yaffs格式的img檔案。網址:http://code.google.com/p/unyaffs/3.
Time of Update: 2018-12-06
今天突然想在Android模擬器中添加歌曲,在網上收了好多,但全是用DOC命令的,按著做了好久,也沒弄好。索性就自己動手了,沒想到一分鐘每到就搞定了。現在貼出來,給與我一樣的菜鳥分享,哈哈……一、先運行AVD,我的是Android2.2版本的。二、然後依次為:window->show view->other後見圖點擊file
Time of Update: 2018-12-06
預設情況下使用ListView背景色是黑色,選中item的醒目提示是菊黃色,很多時候不得不自己定義背景色或者背景圖android:cacheColorHint="@android:color/transparent",意思為去黑色底色,比如ListView滾動時會重新整理介面,預設顏色還是系統色彩,所以採用這種方式設定其為透明即可,這個屬性在ListView中使用圓角圖片來設定ListView時很有用android:divider="@null"用於去掉listview的item之間的黑線1、背
Time of Update: 2018-12-06
例如簡訊或者新聞的條數經常做在圖片之上,實現方式如下,可以根據不同的圖片大小進行調節 private Bitmap generateNumberIcon(int resId, int newsCount){ Bitmap icon = BitmapFactory.decodeResource(getResources(), resId); int iconSize = icon.getWidth(); Bitmap mBitmap =
Time of Update: 2018-12-06
安裝好eclipse後,在AndroidSDK and AVD Manager下下載android的開發包超級慢,有時候要搞好幾個小時,面對這幾k的速度,真的是無奈。 為更快速安裝,可以採取離線安裝方法。即,先分別下載所需包,再安裝。從網上搜來的連結,用迅雷或者別的下載工具開啟,我在ubuntu下,用的是multiget。Googleapi的安裝包http://dl-ssl.google.com/android/repository/google_apis-5_r01.zip
Time of Update: 2018-12-06
一、Java環境安裝配置Ubuntu java安裝配置的詳細步驟1.下載jdk下載串連http://java.sun.com/javase/downloads/index.jsp選擇jdk-6u24-linux-i586.bin下載,我下載的是最新的版本,將jdk-6u24-linux-i586.bin放置於目錄/home/candycai/work(這個自己定義檔案夾,無所謂)。2.解壓檔案開啟終端,進入放置jdk的目錄:cd/home/candycai/candywork;
Time of Update: 2018-12-06
這幾天有開始android的工作,因為好久沒用eclipse,開啟就更新了最新發行的ADT,更新後發現,以前的工程無法顯示Graphical Layout,我也不知所措,查詢了很多資料,都沒有解決問題,整了一早上都是一頭霧水,最後發現更換xml的開啟檔案就解決了:右鍵點擊所要開啟的xml檔案,彈出對話方塊open with,選擇Android Layout editor,你就能看見你的Graphical Layout了。 希望能解決你遇到的問題,節省你寶貴的開發時間。