Time of Update: 2018-12-04
觸摸之後,設定前景色彩,可以告訴使用者確實單擊了,增加使用者體驗。<FrameLayout android:foreground="@drawable/pressed_backgorund_corner" ><?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"><item
Time of Update: 2018-12-04
當父控制項中有子控制項的時候,並且父控制項和子空間都有事件處理(比如單擊事件)。這時,點擊子控制項,父控制項的單擊事件就無效了。如:比如一個LinearLayout裡面有一個子控制項TextView,但是TextView的大小沒有LinearLayout大①如果LinearLayout和TextView都設定了單擊事件,那麼點擊TextView地區的時候,觸發的是TextView的事件,點擊TextView以外的地區的時候,還是觸發的LinearLayout的事件。②如果LinearLayout
Time of Update: 2018-12-04
今天想把drawable下的所有Drawable Resources 弄清楚,看到Clip Drawable 的時候,把以下原文檔裡的列子考到自己建的項目下clip.xml<?xml version="1.0" encoding="utf-8"?><clip
Time of Update: 2018-12-04
首先,定義layout檔案:custom_preference.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"
Time of Update: 2018-12-04
PULL方式除了可以使用 SAX和DOM解析XML檔案,也可以使用Android內建的Pull解析器解析XML檔案。 Pull解析器的運行方式與 SAX
Time of Update: 2018-12-04
CursorAdapter繼承於BaseAdapter是個虛類,它為cursor和ListView提供了串連的橋樑。 public abstract class CursorAdapter extends BaseAdapter直接子類只有ResourceCursorAdapterClass OverviewAdapter that exposes data from a Cursor to a ListView widget. The Cursor mu
Time of Update: 2018-12-04
我們都知道android中Adapter的作用就是ListView介面與資料之間的橋樑,當列表裡的每一項顯示到頁面時,都會調用Adapter的getView方法返回一個View。想過沒有? 在我們的列表有1000000項時會是什麼樣的?是不是會佔用極大的系統資源?我們先來看看下面的代碼:Java代碼:複製到剪貼簿 Java代碼public View getView(int position, View convertView, ViewGroup parent) { View item =
Time of Update: 2018-12-04
Google在Android 3.0SDK中推出的ViewPager控制項很大程度上滿足了開發人員開發頁面左右移動切換的功能,使用非常方便,參見:http://jameszhao84.iteye.com/blog/1344584。但是使用中發現,在刪除或者修改資料的時候,PagerAdapter無法像BaseAdapter那樣僅通過notifyDataSetChanged方法通知重新整理View。最基本的方法:針對於child
Time of Update: 2018-12-04
Android 遊戲引擎匯總1.AndEngine簡介:AndEngine 基於libGDX架構開發,使用OpenGL ES進行圖形繪製。同時繼承了BOX2D物理引擎,因此能實現一些較為複雜的物理效果。在Rokon停止更新以後,AndEngine 成為Android
Time of Update: 2018-12-04
文章目錄 1. View Animation(Tween Animation)2. Drawable Animation(Frame Animation)3. Property Animation3.1 Property Animation的工作方式3.2 ValueAnimator3.3 ObjectAnimator3.4 通過AnimationSet應用多個動畫3.5 TypeEvalutors3.6 TimeInterplator3.7
Time of Update: 2018-12-04
自android3.0來Action Bar就取代了OptionsMenu。於是就涉及了API的設定。 1) 設定<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11" />,表明應用程式可部署於android3.0或之前。也就是說當裝置的SdkVersion==11時,應用程式將啟動Action Bar。但是如何應用程式想使用Action Bar
Time of Update: 2018-12-04
在Android遊戲開發之旅二中我們講到了View和SurfaceView的區別,今天Android123從View類開始著重的介紹 Android圖形顯示基類的相關方法和注意點。(文/Android開發網)自訂View的常用方法:onFinishInflate() 當View中所有的子控制項均被映射成xml後觸發onMeasure(int, int) 確定所有子項目的大小onLayout(boolean, int, int, int, int)
Time of Update: 2018-12-05
將LMbench移植到Android上LMbench是個可移植的,用於評價系統綜合效能的多平台開源benchmark,能夠測試包括文檔讀寫、記憶體操作、進程建立銷毀開銷、網路等效能。通過以下步驟操作,即可將LMbench移植到Android上。1.下載LMbench源碼傳送門:http://www.bitmover.com/lmbench/get_lmbench.html2.編輯scripts/os 添加 OS=arm-linux$vim scripts/os#!/bin/shif [
Time of Update: 2018-12-05
拖動控制項原理其實很簡單,重寫activity的onTouchEvent方法,根據手指所在位置得到x,y座標,再用AbsoluteLayout把指定的控制項設定到該位置。首先,必須用AbsoluteLayout絕對布局:<?xml version="1.0" encoding="utf-8"?><AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2018-12-05
伺服器端servlet:Java codepackage sei.servlet;import java.io.IOException;import java.util.*;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import
Time of Update: 2018-12-05
這裡主要是轉載了日月之明的部落格,連結:http://www.cnblogs.com/lhming/archive/2012/06/27/2566460.html 1、android SDK+NDK安裝1)、安裝java jdk(如果已經安裝了,可以不用此步驟)進入:http://www.oracle.com/technetwork/java/javase/downloads/index.html 或者直接點擊下載。如 選擇JDK DOWNLOAD(android
Time of Update: 2018-12-05
1.在service中重寫下面的方法,這個方法有三個傳回值, START_STICKY是service被kill掉後自動重寫建立@Overridepublic int onStartCommand(Intent intent, int flags, int startId) {return START_STICKY;}----------------@Overridepublic int onStartCommand(Intent intent, int flags, int startId)
Time of Update: 2018-12-05
在實訓項目中有項功能需要在android手機端和web端進行資料轉送,原本剛開始的時候我使用java內建的Json包來處理,但我發現這種做法太過於麻煩(相對於我來說^ ^),所以,經過我上網找資料後發現原來google公司同樣的也提供一個類似於javaJson的開發包,並且google將json解析功能都封裝起來,極大的方便資料的傳輸和解析,好了,下面我們就來看一下我做的例子。。。。。做的不好
Time of Update: 2018-12-05
執行個體代碼為SDK內建的sample NotePadstartActivity(new Intent(Intent.ACTION_EDIT, uri));其中uri為:content://com.google.provider.NotePad/notes/1要啟動的activity為 <activity android:name="NoteEditor" android:theme="@android:style/Theme.Light"
Time of Update: 2018-12-05
SurfaceFlinger 屬於system_server進程,在system_init.cpp中利用SurfaceFlinger::instantiate()啟動,在此加入到service manager中,所以本身提供service服務功能。首先看下SurfaceFlinger的類聲明:class SurfaceFlinger : public BinderService<SurfaceFlinger>, public