Time of Update: 2018-12-06
鎖定 Activity 運行時的螢幕方向Xml代碼<activity android:name=”.EX01″android:label=”@string/app_name”android:screenOrientation=”portrait” // 豎屏 , 值為 landscape 時為橫屏…………</activity>全屏的Activity 要使一個 Activity 全屏運行,可以在其 onCreate()方法中添加如下代碼實現:Java代碼//
Time of Update: 2018-12-06
Activity全屏設定方式1:AndroidManifest.xml<activity android:name="myAcitivty" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />方式2:代碼實現requestWindowFeature(Window.FEATURE_NO_TITLE); // 隱藏標題列getWindow().setFlags(WindowManager.LayoutParams.
Time of Update: 2018-12-06
SimpleAdapter作為一個資料集,主要向ListView、GridView容器填充資料,總結了幾種填充方式,原理很簡單,直接看代碼和1、 ListView單行顯示(simple_list_item_1)代碼:public class myListItem1 extends Activity{@Overridepublic void onCreate(Bundle
Time of Update: 2018-12-06
Android程式調用本機google地圖,傳遞起始和終點位置,產生路線圖Android程式調用本機googlemap,傳遞起始和終點位置,產生路線圖Android程式調用本機googlemap,傳遞起始和終點位置,產生路線圖if (wodeweizhiPoint != null) { if (wodeweizhiPoint.getLatitudeE6() != 0) {float chufajingdu = (float)
Time of Update: 2018-12-06
1. Parcelable介面Interface for classes whose instances can be written to and restored from a Parcel。 Classes implementing the Parcelable interface must also have a static field called CREATOR, which is an object implementing the Parcelable.Creator
Time of Update: 2018-12-06
今天遇到一個很詭異的問題,之前編寫的正確無誤的Android工程,在這次開啟Eclipse之後,工程上居然有個大紅色的叉:仔細查看各程式,沒有任何錯誤,只有個別警告。開啟Window-Show View-Problems,如所示:會看到錯誤原因:Error generating final archive: Debug certificate expired on xxxxxx(日期)這是因為認證到期了。解決方案:C:/Documents and Settings/USER.android
Time of Update: 2018-12-06
TabHost在很多應用都會使用到,有時候在TabHost添加的Tab中設定view不能滿足需求,因為在view中添加如PreferenceActivity相當困難.之前在一個應用中需要實現使用TabHost中在多個Tab切換不同的Activity.一個是日誌列表(ListActivity),一個是應用設定頁面( PreferenceActivity )先上是日誌列表頁面,是ListActivity是設定頁面,是一般的PreferenceActivity開發流程 :1,
Time of Update: 2018-12-06
Spinner是一種下接菜單,類似HTML中的select標籤,點擊後彈出一個對話方塊,顯示幾個供選擇的選項,手機螢幕大小有限,如果都用RadioGroup選項按鈕,會佔用很大的空間。今天的例子最終效果如:Spinner需要綁定一個適配器ArrayAdapter,將功能表項目放在適配器中,添加刪除功能表項目只需要調用適配器的add,remove方法即可。布局XML;<?xml version="1.0" encoding="utf-8"?><LinearLayout
Time of Update: 2018-12-06
最近在做平板開發,覺得把Activity做的像網頁效果那樣比較好。局部介面固定,局部介面可以動態切換。效果如下: 這個效果由3個layout構成main.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
Time of Update: 2018-12-06
搭建程式整體架構,實現登入功能1、使用MVC搭建程式架構,方便後續功能添加2、實現登入功能 登入驗證在微博介面中已封裝好,調用verifyCredentials方法,就好了。Basic Aath: weibo.setUserId(name); weibo.setPassword(password); User u = weibo.verifyCredentials();OAuth認證,傳入token就行了,代碼參見新浪weibo4android
Time of Update: 2018-12-06
首先,我們需要一個keystore,當然已經有了的話就不用這一步了:cmd下:進入到jdk的bin目錄,這樣的話,android.keystore檔案就會產生在這個目錄下,簽名的時候我們需要這個檔案C:\Program Files\Java\jdk1.6.0_10\bin>keytool -genkey -alias android.keystore -keyalg RSA -validity 20000 -keystore
Time of Update: 2018-12-06
1. 需求Eclipse 3.4+本教程還有另外一個不使用Eclipse的版本,參照這裡 。2. 安裝SDK + PhoneGap下載並安裝Eclipse Classic。下載並安裝Android SDK。下載並安裝ADT Plugin。下載 最新版本的PhoneGap並解壓,我們將使用其中的Android目錄。3. 新項目設定啟動Eclipse,然後在菜單“File”下選擇“New > Android
Time of Update: 2018-12-06
android:textAppearance xml布局裡面設定文字的外觀:如“android:textAppearance=“?android:attr/textAppearanceLargeInverse”這裡引用的是系統內建的一個外觀,?表示系統是否有這種外觀,否則使用預設的外觀。可設定的值如下:textAppearanceButton/ textAppearanceInverse/ textAppearanceLarge/
Time of Update: 2018-12-06
關鍵字: Android ListView Header最近使用OPhone SDK來開發一個應用程式。在使用的過程中,出現了一個問題,個人估計是Ophone底層framework的bug。但是沒有底層的支援,苦於沒有辦法,所以只能自己繞過。一:ListView
Time of Update: 2018-12-06
情境:我想顯示sd卡的/DCIM/Camera目錄中的所有圖片到一個列表中,這個列表中的每一項左邊是圖片的縮圖,右邊是檔案名稱。分析:這個應用是很典型的 資料繫結 加 自訂顯示.如何搞定?1. 自訂欄表樣式image_item.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2018-12-06
要把項目改成android版本的,用到WebView類:1、首先必須在AndroidManifest.xml裡配置如下: 目的是允許該控制項訪問瀏覽器資源 </activity> </application> <uses-permission android:name="android.permission.INTERNET" />2、在你所要載入的設定檔裡面配置個WebView(layout檔案夾,main.xml):<
Time of Update: 2018-12-06
項目使用DB檔案較大,前期模擬器開發,所以想把DB push到SDcard然後再讀取:步驟如下:1、運行->cmd->e:->cd e:\PD\android-sdk_r18-windows\tools2、emulator mksdcard 1024M sdcard.img3、啟動模擬器(載入sdcard啟動):emulator -avd android-emulator-2.3.3 -sdcard
Time of Update: 2018-12-06
Android
Time of Update: 2018-12-06
在用android日誌的時候老是彈出一個視窗,內容為:"Copy" did not complete normally. Please see the log for more information. Argument not valid 怎麼解決這個問題呢???自己也不知道是怎麼回事?? 引用 3 樓 yqsqq 的回複:關閉翻譯軟體的劃詞功能就可以了這個可以,我用的是有道這都被你發現了,太牛逼了 [Android討論] 什麼函數,能達到和android手機上按“返回”鍵一樣的效果?
Time of Update: 2018-12-06
最基本分享方法: Intent intent = new Intent(Intent.ACTION_SEND); // 啟動分享發送的屬性intent.setType("text/plain"); // 分享發送的資料類型intent.setPackage(packAgeName);intent.putExtra(Intent.EXTRA_SUBJECT, "xx分享"); // 分享的主題intent.putExtra(Intent.EXTRA_TEXT, "分享內容"); // 分享的內容m