Time of Update: 2018-12-08
前言 本章內容是 android.widget.SpinnerAdapter,版本為Android 2.2 r1,翻譯來自"德羅德",歡迎大家訪問他的部落格:http://sparkrico.javaeye.com,再次感謝"德羅德" !期待你一起參與Android中文API的翻譯,聯絡我over140@gmail.com。 聲明 歡迎轉載,但請保留文章原始出處:)
Time of Update: 2018-12-08
1 ViewPager實現的功能 和實際啟動並執行示意ViewPager類提供了多介面切換的新效果。新效果有如下特徵:[1] 當前顯示一組介面中的其中一個介面。[2] 當使用者通過左右滑動介面時,當前的螢幕顯示當前介面和下一個介面的一部分。[3]滑動結束後,介面自動跳轉到當前選擇的介面中 下面是實現的 2 如何使用ViewPager控制項 2.1 引用ViewPager控制項 ViewPager來源於google
Time of Update: 2018-12-08
view_show.xml複製代碼 代碼如下:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"
Time of Update: 2018-12-08
file: BluetoothEventLoop.java GB/GB2/GB3: 1. import android.os.PowerManager; 2. 變數申明:private PowerManager.WakeLock mWakeLock; 3. BluetoothEventLoop(){} 建構函式裡面添加定義: PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
Time of Update: 2018-12-08
1、關鍵性代碼 複製代碼 代碼如下://R.drawable.test為當前工程裡的一張圖片 Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.test); FileOutputStream fos = null; try { File file = new File("/mnt/sdcard/testfile"); if (!file.exists()) { file.mkdir(); } fos =
Time of Update: 2018-12-08
圖庫在JB和JB2的版本上顯示的行為是:橫屏全螢幕顯示,豎屏會顯示status bar。如何使豎屏也不顯示status bar。 修改alps/packages/apps/Gallery2/src/com/android/gallery3d/app/AbstractGalleryActivity.java中toggleStatusBarByOrientation() 方法: 複製代碼 代碼如下:private void toggleStatusBarByOrientation() { if
Time of Update: 2018-12-08
AppWidgetProvider
Time of Update: 2018-12-08
二、建立樣式日曆顯示的表格線,使用 Cell 填充圖形的邊框來實現,為了統一,我們先定義邊框線的顏色及線條精細。另外還要定義一系統填充樣式等。建立 color:color_calendar_border 表格線color_calendar_title_gregorian 標題列日期年月文字的顏色color_calendar_title_lunar
Time of Update: 2018-12-07
代碼Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-07
當你設計你的資料庫時,這裡有幾點建議你應該考慮一下: ❑ 檔案(例如位元影像或音頻檔案)一般不儲存在資料庫的表中。一般用字串來隱藏檔的路徑,最好是一個正確的Content Provider URI。 ❑ 當沒有嚴格的需求時,強烈建議所有的表中都包含一個自動增加的關鍵字段,它可以用作每行的獨一無二的索引值。值得注意的是,當你計劃用Content Provider來共用你的表,那麼,獨一無二的ID欄位是必須的。
Time of Update: 2018-12-07
前段時間在看一個用proguard加過保護的程式,發現proguard的作用:1)混淆類名,全變成了a.a.a.a.x2)混淆了函數名3)混淆了字串看代碼比較惱火,而且,如果用jd-gui反編譯也會出錯。但是,不管怎麼樣,proguard還是有很大的缺點的,比如String test =
Time of Update: 2018-12-07
Java代碼 public class Splash extends Activity{ private final int SPLASH_DISPLAY_LENGHT = 1000; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub
Time of Update: 2018-12-07
在Android中,菜單被分為如下三種,選項菜單(OptionsMenu)、操作功能表(ContextMenu)和子功能表(SubMenu)。 1. 選項菜單(OptionsMenu)詳解 Activity中需要覆蓋的常用的方法: public boolean onCreateOptionsMenu(Menu menu):使用此方法建立OptionsMenu。該方法只會在選項菜單第一次顯示的時候被執行。 public boolean
Time of Update: 2013-10-28
1.XML中聲明<receiver android:name=".NetworkConnectChangedReceiver" ><intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"
Time of Update: 2013-10-28
MainActivity如下package cn.testmediametadataretriever;import java.io.File;import java.io.FileOutputStream;import android.media.MediaMetadataRetriever;import android.os.Bundle;import android.os.Environment;import android.app.Activity;import
Time of Update: 2013-10-28
在linux終端下輸入: xxnan@xxnan-pt:~/android/android-sdk-linux/tools$ ./emulator -avd
Time of Update: 2013-10-28
private void deleteLatestPhoto() { String[] projection = new String[] { MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATE_TAKEN }; Cursor cursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
Time of Update: 2013-10-28
1.Java運行時: 在bash終端中輸入java,如果沒有安裝java運行時會自動彈出一個Dialog提示是否安裝,點擊安裝即可。 2.Eclipse + ADT + SDK: 在Mac下好像不需要下載Eclipse,又或者是現在Google專門打包定製了開發環境,反正只需要到:http://developer.android.com/sdk/index.html#download下載整合套件即可。順便白一句,在Mac下開啟android.com明顯快很多,沒理由啊…&
Time of Update: 2013-10-28
private void storeInSD(Bitmap bitmap1) { File file = new File(FILE_DIR); if (!file.exists()) { file.mkdir(); } File imageFile = new File(file, FileUtils.getFileName() + ".png"); try { imageFile.createNewFile(); FileOutputStream fos =
Time of Update: 2013-10-28
前段世界在一個應用中調用系統內建的傳送簡訊的Intent,但是接收者的號碼一直穿不過去,代碼如下: 代碼如下 Uri smsToUri = Uri.parse("smsto:123456"); Intent sendIntent = new Intent(Intent.ACTION_VIEW, smsToUri); sendIntent.putExtra("sms_body", "Hello dear world"