Time of Update: 2013-12-10
android:layout_below 將該控制項的頂部至於給定ID的控制項之下android:layout_toLeftOf 將該控制項的右邊緣和給定ID的控制項的左邊緣對齊android:layout_toRightOf 將該控制項的左邊緣和給定ID的控制項的右邊緣對齊android:layout_alignBottom 將該控制項的底部邊緣與給定ID控制項的底部邊緣android:layout_alignLeft
Time of Update: 2013-12-10
日誌跟蹤(alog) 在我們開發手機軟體的過程中,常常需要通過USB線串連電腦看日誌。但在windows下,我們要安裝驅動。有的android板子,就不支援USB調試。所以我開發了這個小工具。方便開啟網路調試,省去用遙控器裡敲命令。軟體介面在開發版上的介面。 在電腦端(確保在同一個網段) aptop:~$ adb connect 192.168.1.110 connected to 192.168.1.110:5555 laptop:~$ adb shell
Time of Update: 2013-12-10
public class MainActivity extends Activity {private GridView gridView;private int res[] = new int[] {R.drawable.an01,R.drawable.an02, R.drawable.an03, R.drawable.an01, R.drawable.an02,R.drawable.an03,R.drawable.an01,R.drawable.an02, R.drawable.an03,
Time of Update: 2013-12-10
public class MainActivity extends Activity {private Gallery gallery;private LayoutInflater inflater;private ImageSwitcher imageSwitcher;private int res[] = new int[] { R.drawable.ic_launcher, R.drawable.an01,R.drawable.an02, R.drawable.an03,
Time of Update: 2013-12-10
package com.ebupt.phonerecorddemo.server;import java.lang.reflect.Method;import android.content.Context;import android.content.Intent;import android.telephony.TelephonyManager;import android.util.Log;import android.view.KeyEvent;import
Time of Update: 2013-12-10
,返回和菜單鍵是可以直接重寫onKeyDown(int keyCode, KeyEvent event) 方法監聽:@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) {if (keyCode == KeyEvent.KEYCODE_BACK) { // 監控/攔截/屏蔽返回鍵//do something} else if (keyCode == KeyEvent.KEYCODE_MENU) {//do
Time of Update: 2013-12-10
URL的openConnection方法將返回一個URLConnection,該對象表示應用程式和URL之間的通訊串連。程式可以通過它的執行個體向該URL發送請求,讀取URL引用的資源。下面通過一個簡單樣本來示範:Activity: package com.home.urlconnection; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection;
Time of Update: 2013-12-10
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.apis"><activity
Time of Update: 2013-12-10
代碼如下: Bitmap bitmap = mWebView.getFavicon(); Drawable drawable = new BitmapDrawable(bitmap); // edit.setCompoundDrawables(drawable, null, null, null); drawable =
Time of Update: 2013-12-10
介面設定檔 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="
Time of Update: 2013-12-10
古希臘數學家畢達哥拉斯在自然數研究中發現,220的所有真約數(即不是自身的約數)之和為:1+2+4+5+10+11+20+22+44+55+110=284。而284的所有真約數為1、2、4、71、 142,加起來恰好為220。人們對這樣的數感到很驚奇,並稱之為親和數。一般地講,如果兩個數中任何一個數都是另一個數的真約數之和,則這兩個數就是親和數。你的任務就編寫一個程式,判斷給定的兩個數是否是親和數 Input輸入資料第一行包含一個數M,接下有M行,每行一個執行個體,包含兩個整數A,B;
Time of Update: 2013-12-10
今天因為要做一個設定開機畫面的功能,主要是讓使用者可以設定自己的開機畫面,應用程式層需要做讓使用者選擇開機畫面圖片的功能。所以需要做一個簡單的圖片瀏覽選擇程式。最後選用Gallery作為基本控制項。加入了一些炫一點的元素,做成3D滑動效果。下面是Demo例子: 這個效果網上已經很多人做出來了,只是這次需要用到,所以自己也實踐了一下(這裡例子我也是根據網上一些資料編寫)。特意找了幾張美女圖片給大家養養眼,O(∩_∩)O哈!下面針對一些關鍵代碼進行簡要說明,需要做這方
Time of Update: 2013-12-10
1.從google搜尋內容Intent intent = new Intent();intent.setAction(Intent.ACTION_WEB_SEARCH);intent.putExtra(SearchManager.QUERY,"searchString")startActivity(intent); 2.瀏覽網頁Uri uri =Uri.parse("http://www.google.com");Intent it = new
Time of Update: 2013-12-10
起因:POS機通過串口發送資料過來,卡資訊資料大小為205個位元組。但是分成100+105 100+50+100等分段情況發過來 解決思路:接到第一份資料的時候等待0.5秒 , 之後完整的資料應該會全部發過來。 byte[] bytTemp = new byte[1024]; int nRetCount = 0;
Time of Update: 2013-12-10
代碼 public String getFromAssets(String fileName){ try {
Time of Update: 2013-12-10
package com.example.wifitest;import java.util.List;import android.content.Context;import android.net.wifi.ScanResult;import android.net.wifi.WifiConfiguration;import android.net.wifi.WifiInfo;import android.net.wifi.WifiManager;import
Time of Update: 2013-12-10
在網上在到一個登入介面感覺挺不錯的,給大家分享一下~先看: 這個Demo除了按鈕、小貓和Logo是圖片素材之外,其餘的UI都是通過代碼實現的。 一、背景 背景藍色漸層,是通過一個xml檔案來設定的。代碼如下: background_login.xml[html] <?xml version="1.0"
Time of Update: 2013-12-10
Intent是什麼呢?來看Android官網上的定義:An intent is an abstractdescription of an operation to be performed. It can be used with startActivity tolaunch an Activity, broadcastIntent tosend it to any interestedBroadcastReceiver components,and startService(Intent)
Time of Update: 2013-12-10
ubuntu:在終端輸入lsusb:langu@langu:~$ lsusbBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 004 Device 001: ID 1d6
Time of Update: 2013-12-10
package cc.testtipmessage2;import com.readystatesoftware.viewbadger.BadgeView;import android.os.Bundle;import android.widget.ImageView;import android.app.Activity;import android.graphics.Color;/** * Demo描述: * 仿Iphone通知角標的實現,藉以提示使用者有幾條新的資訊 * * 參考資料: