Time of Update: 2017-01-19
圖庫在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: 2017-01-19
後台代碼複製代碼 代碼如下: private void ChangeView() { ly.removeAllViews(); LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_
Time of Update: 2017-01-19
Android提供了Invalidate方法實現介面重新整理,但是Invalidate不能直接線上程中調用,因為他是違背了單執行緒模式:Android
Time of Update: 2017-01-19
複製代碼 代碼如下:package com.aslibra.test; import android.app.Activity; import android.graphics.Rect; import android.os.Bundle; import android.util.Log; import android.view.Window; import android.widget.ImageView; public class test extends Activity {
Time of Update: 2017-01-19
複製代碼 代碼如下:findViewById(R.id.myButton).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Do stuff
Time of Update: 2017-01-19
網路上傳言HTC的HERO-ROM支援多點觸摸的論證大多源於瀏覽網頁和圖片時,能像IPhone一樣通過手勢來控制頁面的大小。下面的例子是利用現有的API實現HERO瀏覽圖片和網頁的縮放功能。
Time of Update: 2017-01-19
當螢幕變為橫屏的時候,系統會重新呼叫當前Activity的OnCreate方法,你可以把以下方法放在你的OnCreate中來檢查當前的方向,然後可以讓你的SetContentView來載入不同的Layout xml.複製代碼 代碼如下:if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {Log.i("info", "landscape");}else if
Time of Update: 2017-01-19
複製代碼 代碼如下:public class PageWidget extends View { private Bitmap foreImage; private Bitmap bgImage; private PointF touchPt; private int screenWidth; private int
Time of Update: 2017-01-19
複製代碼 代碼如下: public class LoadActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE);// 去掉標題列
Time of Update: 2017-01-19
很多人對 Android提供的ImageButton有個疑問,當顯示Drawable圖片時就不會再顯示文字了,其實解決的方法有三種: 第一種:就是圖片中就寫入文字,但是這樣解決會增加程式體積,同時寫入程式碼方式會影響多國語言的發布。 第二種:解決方案很簡單,通過分析可以看到ImageButton的 layout,我們可以直接直接繼承,添加一個TextView,對齊為右側即可實現ImageButton支援文字右側顯示。 第三種:更簡潔效率的方法:使用Button ,然後設定Button 的
Time of Update: 2017-01-19
1,android:orientation 布局方向。horizontal是讓所有的子項目按水平方向從左至右排列, vertical是讓所有的子項目按豎直方向從上到下排列。 2,android:gravity 與 android:layout_gravity的區別android:gravity是指定本元素的子項目相對它的對齊。 android:layout_gravity是指定本元素相對它的父元素的對齊。 例如: 下面這裡的linearlayout的android:gravity設為right,
Time of Update: 2017-01-19
複製代碼 代碼如下:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallerylayout" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Gallery android:id="@+id/overview"
Time of Update: 2017-01-19
•android-support-v4.jar,這是Google官方給我們提供的一個相容低版本Android裝置的軟體包,裡麵包囊了只有在Android3.0以上可以使用的api。而ViewPager就是其中之一,利用它我們可以做很多事情,從最簡單的導航,到頁面切換菜單等等。•ViewPager的功能就是可以使視圖滑動,就像Lanucher左右滑動那樣。
Time of Update: 2017-01-19
step1:建立一個項目Compass,並將一張指南針圖片匯入到res/drawable-hdpi目錄中 step2:設計應用的UI介面,main.xml 複製代碼 代碼如下: <SPAN style="FONT-SIZE: 18px"><STRONG><?xml version="1.0" encoding="utf-8"?> <LinearLayout
Time of Update: 2017-01-19
1.android 的座標系是如何定義x, y Z 軸的 x軸的方向是沿著螢幕的水平方向從左向右,如果手機不是正方形的話,較短的邊需要水平放置,較長的邊需要垂直放置。Y軸的方向是從螢幕的左下角開始沿著螢幕的的垂直方向指向螢幕的頂端。 將手機放在桌子上,z軸的方向是從手機指向天空。 2.方向感應器 在方向感應器中values變數的3個值都表示度數,它們的含義如下:
Time of Update: 2017-01-19
Android裡有兩個類android.view.GestureDetectorandroid.view.GestureDetector.SimpleOnGestureListener(另外android.widget.Gallery好像是更牛x的OnGestureListener )1)建立一個類繼承SimpleOnGestureListener,HahaGestureDetectorListener可以實現以下event事件。boolean onDoubleTap(MotionEvent
Time of Update: 2017-01-19
在nvram_cust_pack.c中COMMON_NVRAM_EF_SMSAL_COMMON_PARAM_DEFAULT 複製代碼 代碼如下: kal_uint8 const COMMON_NVRAM_EF_SMSAL_COMMON_PARAM_DEFAULT[] = { #if defined (__CS_SERVICE__) && defined (__SMS_OVER_PS_SUPPORT__) 0x03, /* bearer service : GSM prefer */ #elif
Time of Update: 2017-01-19
Android中提供了一個名為WakeLock的類在android.os.PowerManager.WakeLock中,從名字來看WakeLock是喚醒鎖的意思,它可以控制螢幕的背光開關,所以在電源管理類。 WakeLock執行個體化方法比較簡單,因為是系統的遠程服務,通過下面的代碼來構造複製代碼 代碼如下: PowerManager pm = (PowerManager)
Time of Update: 2017-01-19
要求設定預設通道50與60,並支援雙卡。 在PhoneApp.java檔案中增加code: 在檔案開頭部分import 包: 複製代碼 代碼如下: import android.provider.Telephony; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import android.content.ContentValues; import android.database.Cursor;
Time of Update: 2017-01-19
很多網友可能發現Android中除了Service還有一個IntentService,他們之間到底有哪些區別呢? 在繼承關係上而言IntentService是Service的子類,內部實現的代碼中涉及到一些Android入門開發人員不瞭解的Looper,Android123在早期的文章中已經說明他們的用法,這裡不再贅述,有關原理大家可以看源碼實現如下: 複製代碼 代碼如下:public abstract class